Hi Anuj,
I am providing comments regarding your first attempt to call mapply.
Since you are working with named arguments, you shouldn't need to include
the NULLs in the call.
Also you have provided the argument MoreArgs twice, which is what is
causing the Error message.
You can replace that call with the following:
mapply (chart_Series, mget(symVec), name=infoVec, MoreArgs=c(cp,ct) )

Best,
Eric


On Sat, Jul 27, 2019 at 8:52 PM Anuj Goyal <anuj.go...@gmail.com> wrote:

> R version 3.6.0 (2019-04-26) on Mac 10.14.5
>
> What is the proper way to pass chart_pars() as well as chart_theme()
> into MoreArgs for use in quantmod::chart_Series?
>
> p.txt
> =======
> s,n
> ABBV,AbbVie
> BMY,Bristol
>
> sof.r
> =======
> # R --silent --vanilla < sof.r
> library(quantmod)
> options("getSymbols.warning4.0"=FALSE)
> options("getSymbols.yahoo.warning"=FALSE)
>
> # setup chart params
> cp <- chart_pars()
> cp$cex=0.55
> cp$mar=c(1,1,0,0) # B,L,T,R
>
> # setup chart theme
> ct <- chart_theme()
> ct$grid.ticks.lwd=1
>
> # read values into vectors
> csv <- read.csv("p.txt", stringsAsFactors = FALSE)
> symVec <- getSymbols(as.vector(csv$s))
> infoVec <- mapply(paste, csv$s, csv$n, sep=": ") # eg. SYM: Name
> cpVec = rep(cp, times=nrow(csv))
>
> # create PDF
> pdf(file = "p.pdf")
> par(mfrow = c( 5, 4 ) )
> mapply (chart_Series, mget(symVec), name=infoVec, NULL, NULL, NULL,
> MoreArgs=cp, MoreArgs=ct)
> dev.off()
>
> Error
> ======
> Error in mapply(chart_Series, mget(symVec), name = infoVec, NULL,
> NULL, : formal argument "MoreArgs" matched by multiple actual
> arguments
> Execution halted
>
>
> >>> I also tried this.
>
> mapply (chart_Series, mget(symVec), name=infoVec, NULL, NULL, NULL,
> MoreArgs = list(quote('pars=cp')))
>
> Error in mapply(chart_Series, mget(symVec), name = infoVec, NULL,
> NULL, : zero-length inputs cannot be mixed with those of non-zero
> length Execution halted
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to