On a side note:
On Thu, May 20, 2010 at 9:43 AM, Ivan Calandra
wrote:
> Thanks to all of you for your answers!
>
> ...
>
> Tao, I don't understand why you have backslashes before "file" and after
> .rda. I guess it's something about regular expression, but I'm still
> very new to it.
> eval(parse
Hi Dennis,
What is the problem with using eval(parse(text=...))? Is there a reason
why not to use it?
Of course, in that case, "list" within save() is much easier and works
perfectly.
In any case, thanks for your explanations :)
Ivan
Le 5/20/2010 10:26, Dennis Murphy a écrit :
> Hi:
>
> On Thu
Thanks to all of you for your answers!
Peter's is definitely the easiest :)
for (i in 1:4) {
temp <- data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)])
filename <- paste("file", i, sep="")
assign(filename, temp)
save(list=c(filename), file=paste(filename, ".rda", sep=""))
}
Tao, I do
On 2010-05-19 12:05, Shi, Tao wrote:
Ivan,
Try this:
eval(parse(text=paste("save(file", i, ", file=\"file", i, ".RData\")", sep="")))
...Tao
Or just use 'list=' like this:
for (i in 1:4) {
temp <- data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)])
filename <- paste("file", i, sep="")
Hi Ivan,
How about this?
i <- 1:4
sapply(i,
function(i){
x <- data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)])
save(x, file = paste("file", i, ".rda", sep=""))
}
)
HTH,
Jorge
On Wed, May 19, 2010 at 10:56 AM, Ivan Calandra <> wrote:
> Dear users,
>
> My problem concerns save() within a f
Ivan,
Try this:
eval(parse(text=paste("save(file", i, ", file=\"file", i, ".RData\")", sep="")))
...Tao
- Original Message
> From: Ivan Calandra
> To: r-help@r-project.org
> Sent: Wed, May 19, 2010 7:56:44 AM
> Subject: [R] save in for loop
>
> Dear users,
My problem concerns sav
6 matches
Mail list logo