I am replying to myself as regardless of the save I described below I also want to do something like the following

do_analysis_for_data_sets <- function(AnalysisFunction, DataSets, ...) {
          lapply(DataSets,AnalysisFunction, "how to pass the ...  to lapply")
}

which means that I want to pass the .... also to the lapply (I am using mclapply actually that have the same syntax).


Could you please comment on that as well as too my point before (About how to write a function that given a path inpuit saves the file as eps)


B.R

Alex



________________________________

To: "R-help@r-project.org" <R-help@r-project.org>
Sent: Sunday, October 30, 2011 9:15 PM
Subject: [R] Generic Plot and save function

Dear all,

I was reading for the nice ... parameter option in R, which if I got it right it is used to pass other parameter to some other function inside your function

for example


plot_duty_cycle<- function(data, ...) {
             barplot(duty_cycle_per_bin(data), ...)
}

I can put some parameters to pass inside the barplot function inside my function.


I would like to ask you if there is a "smart" way to also put some parameter in the input section of my function so to also save the plot in the given path

I am thinking for something like that

plot_duty_cycle<- function(data, ...) {
             barplot(duty_cycle_per_bin(data), ...)
       if (is(path) { save somehow the plot in the path}
}


Could you please give me a nice hint for that case

B.R
Alex
    [[alternative HTML version deleted]]


______________________________________________
R-help@r-project.org mailing list
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.
	[[alternative HTML version deleted]]

