[R] use variable value as vector name

From: Qian R <qianrstudy_at_yahoo.com>
Date: Wed, 09 Jul 2008 15:33:58 -0700 (PDT)

Here is my problem
 

a <- data$name[1]  
b <- data$name[2]
c <- data$name[3]

 

a
"apple"
b
"pear"
c
"banana"
 

result  <- c( a = 2 , b=3, c=5)
 


output:
a  b c
2  3 5
 

But I want my output
apple  pear  banana
2         3         5
      
	[[alternative HTML version deleted]]


______________________________________________

R-help_at_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. Received on Wed 09 Jul 2008 - 22:41:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jul 2008 - 23:31:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive