I have a dataframe with first 9 columns as identifying information of the individual records - information I will use to aggregate later
However that dataframe needs to have the rest of the columns scaled to do cluster analysis
I scaled using (names made up for illustration)
dfscaled<-scale(df[-9])
the dataframe has 43 columns and over 4M rows.
I need to join the scaled back to the original df[10,43]
how do I do this because the dfscaled doesn't have a key column label in the merge function
Help please! Thank you very much for any assistance!
Just use cbind or bind_cols (dplyr):
data.to_scale<-raw_data [,10 :NCOL(raw_data)]
scaled_data<-scale(data.to_scale)
scaled_data_complete<-cbind(raw_data [,1:9], scaled_data)