a <- "apple"
b <- "pear"
c <- "banana"
result <- c(2, 3, 5)
names(result) <- c(a, b, c)

Qian R wrote:
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@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.

Reply via email to