Consider using a 'list' instead of creating a lot of objects that you then
have to manage:
x <- lapply(1:length(stats$hour), function(.indx) dataset[.indx, 3:15])
You can then access the data as x[[1]], ...
On Tue, May 20, 2008 at 12:58 PM, Douglas M. Hultstrand <
[EMAIL PROTECTED]> wrote:
> He
Take a look at ?assign
Juan Manuel Barreneche wrote:
I had to do the same thing many times, i usually use a combination of the
functions "eval", "parse" and "sprinf", as below:
k <- 1
for (i in 1:length(stats$hour)) {
eval(parse(text=sprintf("x%s <- dataset[%s,(3:15)]", i, k)))
k <- k+1
I had to do the same thing many times, i usually use a combination of the
functions "eval", "parse" and "sprinf", as below:
k <- 1
for (i in 1:length(stats$hour)) {
eval(parse(text=sprintf("x%s <- dataset[%s,(3:15)]", i, k)))
k <- k+1
}
what it does is:
eval(parse(text=STRING)) is a way to
Douglas -
To answer your question directly, use perhaps combination of ?assign and
?paste.
In general, you usually do not have to do this sort of thing, but can
use one of the apply family of functions (apply, sapply, lapply, mapply)
to do whatever you want with shorter, cleaner code and few
4 matches
Mail list logo