Re: [R] Combine Values into a Vector or List

From: Diego Culattoni <>
Date: Tue, 29 Apr 2008 10:20:59 -0700 (PDT)

Hi Richard,

Thanks a lot! What I actually want to have


..... and so on! Is this possible?

Thank you again :)!

> x1<-paste("A", 1:6, sep = "")
> x2<- round(rgamma(6,2,1))
> x3<-paste("B", 1:6, sep = "")
> x4<- round(rgamma(6,2,1))
> data1 <- data.frame(x1,x2,x3,x4)
> I would like to get
> data2 <- c(A1=4, A2=1, A3=0,...)
> Is there any standard for such a case?

I presume that 4, 2, 0 are the first few values of x2. In which case, I think that what you want is simply this:

names(x2) <- x1


Mathematical Sciences Unit

ATTENTION: This message contains privileged and confidential inform...{{dropped:28}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Apr 2008 - 18:20:08 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 Tue 29 Apr 2008 - 19:30:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive