On 2010-11-19 22:37, Jinsong Zhao wrote:> Hi there,
>
> When I run the following code, I could get correct objects (with correct
> values):
>
> for(i in 1:6) { #-- Create objects 'r.1', 'r.2', ...
'r.6' --
> nam <- paste("r",i, sep=".")
> assign(nam, 1:i)
> # save(nam, file = paste(nam, "RData", sep = "."))
> }
>
> I hope to save the object 'r.1', 'r.2', ..., 'r.6'
using the above
> commented line, however, I just got 'r.1.RData' with a object
'nam' in
> it, which had the value, e.g., 'r.6', not the value of
'r.6', i.e., 1:6.
>
> Any suggestions? Thanks in advance.
>
> Jinsong
>
sorry for the noise. problem solved. just change the
save(nam, file = paste(nam, "RData", sep = "."))
to
save(list = nam, file = paste(nam, "RData", sep = "."))
Regards,
Jinsong