Hi Richard,
Thanks a lot! What I actually want to have
>A1
4
>A2
2
..... and so on! Is this possible?
Thank you again :)!
----- Original Message ----
From: "Richard.Cotton@hsl.gov.uk"
To: Diego Culattoni
Cc: r-help@stat.math.ethz.ch; r-help-bounces@r-project.org
Sent: Monday, April 28, 2008 11:24:12 AM
Subject: Re: [R] Combine Values into a Vector or List
> 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
Regards,
Richie.
Mathematical Sciences Unit
HSL
------------------------------------------------------------------------
ATTENTION:
This message contains privileged and confidential inform...{{dropped:28}}