[R] standardize columns selectively within a  dataframe
    Olga Lyashevska 
    olga at herenstraat.nl
       
    Wed Sep  1 16:35:20 CEST 2010
    
    
  
Dear all,
I have a dataframe:   
df<-dataframe(a=c(1,2,3),b=c(4,5,6),c=c(7,8,9),d=c(10,11,12))
I want to obtain a new dataframe with columns a and b being standardized
((x-mean(x))/sd(x)); the other two columns (c,d) I want to leave
unchanged. What is the best way to achieve this? I have been trying to
use subscripts but did not succeed so far. 
Any tips?
Many thanks,
Olga
    
    
More information about the R-help
mailing list