Dear list,

This may sound silly. What is the right way to change the names of a
dataframe? Let's say I have this data frame (dose) with four columns with
names "ID", "DOSE", "TIME" "CMT". I want to change "DOSE" to "AMT". So I did

names(dose[2])<-'AMT'

But nothing happened. The name of the second column is still "DOSE".

Only this works

names(dose)[2]<-'AMT'

I wonder what is wrong with the first method. Thanks.

Jun

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to