[R] R: x-y data

john seers (IFR) john.seers at bbsrc.ac.uk
Wed Jun 6 16:45:21 CEST 2007



 
tt<-read.table("C:/temp/test.csv", header=T, sep=",")

# Try:

tt$x
tt$y

# OR

tt["x"]
tt["y"]

# OR

tt[["x"]]
tt[["y"]]

# OR

tt[1]
tt[2] 
tt[[1]]
tt[[2]]

# Is this what you want?



>I have an Excel file with x-y data. I saved this file as a cvs file.
Then I
>used the read.table() function to read the data into R. If I have a
formula
>like (x+y)/2, how would I access x and y in R? I have the table named
as
>something. But how do I access the individual columns if I want to plug
them
>into the formula?



More information about the R-help mailing list