[R] R function stopped working
S Ellison
S.Ellison at LGCGroup.com
Tue Apr 4 16:38:12 CEST 2017
Maybe a daft question arising from lack of reproducible example, but have you run ls() manually to make sure there are objects that _exactly_ match "_Figs_" ?
The simplest explanation for a loop doing nothing is that there are no cases.
S Ellison
> The following function is supposed to search the workspace and save plots
> (i.e. listing all objects in the workspace named "Figs", which are all ggplot2
> plots, and saving them as png files)
>
> SaveFigs <- function()
> {
> for (i in ls(pattern="_Figs_"))
> {
> filename = paste(Plots_Path, i, ".png", sep="")
> png(filename)
> print(eval(as.name(i)))
> dev.off()
> }
> }
>
>
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list