Passing a list of arguments to plot in R -
i use same arguments several calls plot
. tried use list (which can serve dictionary) :
a <- list(type="o",ylab="") plot(x,y, a)
but not work :
error in plot.xy(xy, type, ...) : invalid plot type
any suggestion ?
extending @baptiste's answer, can use do.call
this:
x <- 1:10 # data y <- 10:1 do.call("plot", list(x,y, type="o", ylab=""))
or setting arguments in list , call a
a <- list(x,y, type="o", ylab="") do.call(plot, a)
Comments
Post a Comment