への複数の呼び出しに同じ引数を使用したいと思いますplot
。リストを使用しようとしました(辞書として機能します):
a <- list(type="o",ylab="")
plot(x,y, a)
しかし、それは機能しません:
Error in plot.xy(xy, type, ...) : invalid plot type
なにか提案を ?
@baptiste の回答を拡張すると、次のdo.call
ように使用できます。
x <- 1:10 # some data
y <- 10:1
do.call("plot", list(x,y, type="o", ylab=""))
または、引数をリストに設定して呼び出しますa
a <- list(x,y, type="o", ylab="")
do.call(plot, a)
もう 1 つのオプションは、関数ラッパーを作成することです。
myplot <- function(...) plot(...,type="o",ylab="")
myplot(x,y)