On Aug 18, 2011, at 1:36 AM, Jie TANG wrote:

for example:
 a data.frame
 data
 V1  V2 V3
 1     2   3
 4     5   6

If I want to calculate the V2
I can get data$V2
But now I want to calculate the dimension name and then analysis the data.
for example
No=3*x ;x=1,2,3,...n
anadata=data$VNo
How could I do?

If you are asking how to access the n-th column then try this:

data[[n]]  # returns a vector

 or

data[1:5]  # returns a dataframe

You could also use:

vname <- paste("V", 1:5, sep="")
data[vname]

This does suggest that yoy need to read your introductory material more closely, because this would be covered in an early chapter.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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