Martijn Ras wrote:> Heya Folks,
>
> I've got to process a form that contains variable series of values,
> which i want to collect into a vectors.
>
> Say the first series has ten values, with id's ranging from X1 to X10,
> currently i process them in the following hardcoded manner:
>
> x1 <- c(as.numeric(POST$X1), as.numeric(POST$X2), as.numeric(POST$X3),
> as.numeric(POST$X4), as.numeric(POST$X5), as.numeric(POST$X6),
> as.numeric(POST$X7), as.numeric(POST$X8), as.numeric(POST$X9),
> as.numeric(POST$X10))
I guess unlist helps:
x1 <- as.numeric(unlist(POST))
but hard to be sure without seeing the original object for which
str(POST)
would have been helpful.
Uwe Ligges
>
> Is there a way to process these in a loop?
>
> Mazzel,
>
> Martijn.
>
> ______________________________________________
> 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.