[R] Renaming variables
Simon Zehnder
szehnder at uni-bonn.de
Fri Sep 20 16:28:57 CEST 2013
You haven't said yet, what object your 'data file' is. If you mean a data.frame I would use colnames(dataName) <- c("Col1Name", "col2Name", ….)
Best
Simon
On Sep 20, 2013, at 4:10 PM, Preetam Pal <lordpreetam at gmail.com> wrote:
> Hi,
>
> I guess this is pretty basic.
>
> I have 25 variables in the data file (name: score), i.e. X1,X2,.....,X25.
>
> I dont want to use score$X1, score$X2 everytime I use these variables.
>
> Is there a way I can rename all these variables as simply X1,X2,.....X25
> without writing 25 lines of code, one line for renaming each variable (eg:
>> X1=score.X1 >X2=score.X2 and so on) ?
>
> Thanks for your help.
>
> Regards,
> Preetam
>
> --
> Preetam Pal
> (+91)-9432212774
> M-Stat 2nd Year, Room No. N-114
> Statistics Division, C.V.Raman
> Hall
> Indian Statistical Institute, B.H.O.S.
> Kolkata.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list