[R] Separating variables in read.table

Johannes Huesing johannes at huesing.name
Fri Apr 17 22:17:30 CEST 2009


Richardson, Patrick <Patrick.Richardson at vai.org> [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
> 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

?attach

Does this do what you want?


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




More information about the R-help mailing list