Hi,
I have a problem in renaming R object and saving them within a loop. For ex:
for (i in 1:length(all_files))
{
uncov_GR <- "variable created in loop"
filename <- paste0(sample_name[[i]],"_uncov", ".Rdata"))
save(uncov_GR,file=filename)
}
Within the above short code (out of a long program), I want to change the
name of "uncov_GR" variable to the file name and save it by same file name.
But I am unable to come up with any solution to do so.
I tried something like the code below:
for (i in 1:length(all_files))
{
uncov_GR <- "variable created in loop"
filename <- paste0(sample_name[[i]],"_uncov", ".Rdata"))
Objectout <- paste0(sample_name[[i]],"_uncov")
assign(Objectout, uncov_GR)
save(Objectout,file=filename) ### problem still persists with
saving
}
Here I am able to make a copy of uncov_GR but I am unable to save the
object again with the same filename. Any suggestions in this regard would
be highly appreciated.
Thanks.
Regards,
Kamal
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel