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}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.