[R] R: x-y data

2007-06-06 Thread tronter

Hello

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?

Thanks
-- 
View this message in context: 
http://www.nabble.com/R%3A-x-y-data-tf3874502.html#a10978448
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R: x-y data

2007-06-06 Thread jim holtman
Can you provide an example of your data.  Assuming that you have a .cvs file
and the column names are 'x' and 'y' and you have used 'read.csv', then you
would have:

(something$x + something$y) / 2



On 6/5/07, tronter [EMAIL PROTECTED] wrote:


 Hello

 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?

 Thanks
 --
 View this message in context:
 http://www.nabble.com/R%3A-x-y-data-tf3874502.html#a10978448
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R: x-y data

2007-06-06 Thread john seers \(IFR\)


 
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?

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R: x-y data

2007-06-06 Thread John Kane
There are a couple of ways but I think you need to
read  about R . Have a look at Managing data
http://cran.r-project.org/doc/contrib/Lemon-kickstart/index.html

and / or read the Intro to R manual available on CRAN
or probably from the R help icon. 

you have a data.frame DF you can assign names to the
variables 

?names
names(DF) - c(x, y) and attach the data.frame

?attach

or you can reference the columns

as DF[,1] and DF[,2]



--- tronter [EMAIL PROTECTED] wrote:

 
 Hello
 
 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?
 
 Thanks
 --

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R: x-y data

2007-06-06 Thread Jeff Newmiller
Or read ?attach

   attach(something)
   (x+y)/2
   detach(something)

jim holtman wrote:
 Can you provide an example of your data.  Assuming that you have a .cvs file
 and the column names are 'x' and 'y' and you have used 'read.csv', then you
 would have:
 
 (something$x + something$y) / 2
 
 
 
 On 6/5/07, tronter [EMAIL PROTECTED] wrote:

 Hello

 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?

-- 
---
Jeff NewmillerThe .   .  Go Live...
DCN:[EMAIL PROTECTED]Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.