[R] a syntax question: $V100
Liaw, Andy
andy_liaw at merck.com
Mon Feb 14 21:37:48 CET 2005
x[,20] or x[[20]] will give you the 20th column of the data frame. Things
like these are covered in `An Introduction to R'.
If the column names are not necessarily in order, you can always use
something like x[[paste("V", 20, sep="")]].
Andy
> From: WeiWei Shi
>
> Hi, there:
>
> I have a syntax question. I have a dataset x with 100 variables. I did
> not set the column name so I used x$V1...x$V100. For my case, I need
> to put the number (e.g. 20) into another variable, like index so that
> I can refer to x$V20 by using something like x$V(index) but I don't
> know how to do that in R.
>
> thanks,
>
> Ed
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list