Re: [R] Separating variables in read.table

2009-04-17 Thread Richardson, Patrick
Yes.

attach() was what I was needing.

Thanks to all those who replied.

Patrick


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Johannes Huesing
Sent: Friday, April 17, 2009 4:18 PM
To: r-help@r-project.org
Subject: Re: [R] Separating variables in read.table

Richardson, Patrick  [Fri, Apr 17, 2009 at 
09:31:35PM CEST]:
> If I have a table (we'll call it, "test") containing seven columns (as below):
> 
> i x1  x2  x3  x4  x5  y
> 0 1.125   0.232   7.160   0.0859 8.905 1.5563
> 7 0.920   0.268   8.804   0.0865 7.388 0.8976
> 150.835   0.271   8.108   0.0852 5.348 0.7482
> 221.000   0.237   6.370   0.0838 8.056 0.7160
> 291.150   0.192   6.441   0.0821 6.960 0.3130
> 370.990   0.202   5.154   0.0792 5.690 0.3617
> 440.840   0.184   5.896   0.0812 6.932 0.1139
> 580.650   0.200   5.336   0.0806 5.400 0.1139
> 
> 
> Is there a simple command to break this table into individual variables 
> without having to code:
> 
> i <- test$i
> x1 <- test$x1
> x2 <- test$x2

?attach

Does this do what you want?


-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:johan...@huesing.name  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")

__
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.

This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential information.  Any 
unauthorized review, use, disclosure or distribution is prohibited.  If you are 
not the intended recipient(s) please contact the sender by reply email and 
destroy all copies of the original message.  Thank you.
__
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.


Re: [R] Separating variables in read.table

2009-04-17 Thread Johannes Huesing
Richardson, Patrick  [Fri, Apr 17, 2009 at 
09:31:35PM CEST]:
> If I have a table (we'll call it, "test") containing seven columns (as below):
> 
> i x1  x2  x3  x4  x5  y
> 0 1.125   0.232   7.160   0.0859 8.905 1.5563
> 7 0.920   0.268   8.804   0.0865 7.388 0.8976
> 150.835   0.271   8.108   0.0852 5.348 0.7482
> 221.000   0.237   6.370   0.0838 8.056 0.7160
> 291.150   0.192   6.441   0.0821 6.960 0.3130
> 370.990   0.202   5.154   0.0792 5.690 0.3617
> 440.840   0.184   5.896   0.0812 6.932 0.1139
> 580.650   0.200   5.336   0.0806 5.400 0.1139
> 
> 
> Is there a simple command to break this table into individual variables 
> without having to code:
> 
> i <- test$i
> x1 <- test$x1
> x2 <- test$x2

?attach

Does this do what you want?


-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:johan...@huesing.name  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")

__
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.


Re: [R] Separating variables in read.table

2009-04-17 Thread Phil Spector

Patrick -
   There's no simple way to do what you want, because
R discourages you from having lots of separate
related objects.  Instead, you are encouraged to store
your objects in an organized form, such as a list, 
data frame  or matrix.  For your example, I'm assuming 
you are using the word "table" to describe a data.frame. 
If this is the case , you can refer to the individual

columns of test as

test[,1]
test[,2]
  etc.

or

test$x1
test$x2
  etc.

or

test[,'x1']
test[,'x2']

Also remember that R has functions that can operate on
each row or column of a matrix or data frame.  So if you 
wanted the means of each column of test, you could write


apply(test,2,mean)
   - Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu


On Fri, 17 Apr 2009, Richardson, Patrick wrote:


If I have a table (we'll call it, "test") containing two columns (as below):

i   x1  x2  x3  x4  x5  y
0   1.125   0.232   7.160   0.0859 8.905 1.5563
7   0.920   0.268   8.804   0.0865 7.388 0.8976
15  0.835   0.271   8.108   0.0852 5.348 0.7482
22  1.000   0.237   6.370   0.0838 8.056 0.7160
29  1.150   0.192   6.441   0.0821 6.960 0.3130
37  0.990   0.202   5.154   0.0792 5.690 0.3617
44  0.840   0.184   5.896   0.0812 6.932 0.1139
58  0.650   0.200   5.336   0.0806 5.400 0.1139


Is there a simple command to break this table into individual variables without 
having to code:

i <- test$i
x1 <- test$x1
x2 <- test$x2
.
.
.
And so on. .

Many Thank for any assistance.

Patrick
This email message, including any attachments, is for th...{{dropped:6}}

__
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.



__
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.


Re: [R] Separating variables in read.table

2009-04-17 Thread Etienne Bellemare Racine
see ?attach

Etienne

Richardson, Patrick a écrit :
> If I have a table (we'll call it, "test") containing two columns (as below):
>
> i x1  x2  x3  x4  x5  y
> 0 1.125   0.232   7.160   0.0859 8.905 1.5563
> 7 0.920   0.268   8.804   0.0865 7.388 0.8976
> 150.835   0.271   8.108   0.0852 5.348 0.7482
> 221.000   0.237   6.370   0.0838 8.056 0.7160
> 291.150   0.192   6.441   0.0821 6.960 0.3130
> 370.990   0.202   5.154   0.0792 5.690 0.3617
> 440.840   0.184   5.896   0.0812 6.932 0.1139
> 580.650   0.200   5.336   0.0806 5.400 0.1139
>
>
> Is there a simple command to break this table into individual variables 
> without having to code:
>
> i <- test$i
> x1 <- test$x1
> x2 <- test$x2
> .
> .
> .
> And so on. . 
>
> Many Thank for any assistance.
>
> Patrick
> This email message, including any attachments, is for ...{{dropped:12}}

__
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.


Re: [R] Separating variables in read.table

2009-04-17 Thread Jorge Ivan Velez
Dear Patrick,

Perhaps attach might be what you are looking for.
attach(test)
i
x1
x2
.
.
.
y

HTH,

Jorge


On Fri, Apr 17, 2009 at 3:23 PM, Richardson, Patrick <
patrick.richard...@vai.org> wrote:

> If I have a table (we'll call it, "test") containing two columns (as
> below):
>
> i   x1  x2  x3  x4  x5  y
> 0   1.125   0.232   7.160   0.0859 8.905 1.5563
> 7   0.920   0.268   8.804   0.0865 7.388 0.8976
> 15  0.835   0.271   8.108   0.0852 5.348 0.7482
> 22  1.000   0.237   6.370   0.0838 8.056 0.7160
> 29  1.150   0.192   6.441   0.0821 6.960 0.3130
> 37  0.990   0.202   5.154   0.0792 5.690 0.3617
> 44  0.840   0.184   5.896   0.0812 6.932 0.1139
> 58  0.650   0.200   5.336   0.0806 5.400 0.1139
>
>
> Is there a simple command to break this table into individual variables
> without having to code:
>
> i <- test$i
> x1 <- test$x1
> x2 <- test$x2
> .
> .
> .
> And so on. .
>
> Many Thank for any assistance.
>
> Patrick
> This email message, including any attachments, is for ...{{dropped:13}}

__
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.


[R] Separating variables in read.table

2009-04-17 Thread Richardson, Patrick
If I have a table (we'll call it, "test") containing seven columns (as below):

i   x1  x2  x3  x4  x5  y
0   1.125   0.232   7.160   0.0859 8.905 1.5563
7   0.920   0.268   8.804   0.0865 7.388 0.8976
15  0.835   0.271   8.108   0.0852 5.348 0.7482
22  1.000   0.237   6.370   0.0838 8.056 0.7160
29  1.150   0.192   6.441   0.0821 6.960 0.3130
37  0.990   0.202   5.154   0.0792 5.690 0.3617
44  0.840   0.184   5.896   0.0812 6.932 0.1139
58  0.650   0.200   5.336   0.0806 5.400 0.1139


Is there a simple command to break this table into individual variables without 
having to code:

i <- test$i
x1 <- test$x1
x2 <- test$x2
.
.
.
And so on. . 

Many Thank for any assistance.

Patrick
This email message, including any attachments, is for th...{{dropped:6}}

__
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.


[R] Separating variables in read.table

2009-04-17 Thread Richardson, Patrick
If I have a table (we'll call it, "test") containing two columns (as below):

i   x1  x2  x3  x4  x5  y
0   1.125   0.232   7.160   0.0859 8.905 1.5563
7   0.920   0.268   8.804   0.0865 7.388 0.8976
15  0.835   0.271   8.108   0.0852 5.348 0.7482
22  1.000   0.237   6.370   0.0838 8.056 0.7160
29  1.150   0.192   6.441   0.0821 6.960 0.3130
37  0.990   0.202   5.154   0.0792 5.690 0.3617
44  0.840   0.184   5.896   0.0812 6.932 0.1139
58  0.650   0.200   5.336   0.0806 5.400 0.1139


Is there a simple command to break this table into individual variables without 
having to code:

i <- test$i
x1 <- test$x1
x2 <- test$x2
.
.
.
And so on. . 

Many Thank for any assistance.

Patrick
This email message, including any attachments, is for th...{{dropped:6}}

__
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.