I'm launching from Windows command line (cmd.exe
) the following:
C:\Users\lisa>"C:\Program Files\R\R-3.4.0\bin\Rscript.exe" -e rmarkdown::render('O:/ope/Auto/bin/IHYG.Rmd') "https://www.ishares.com/it/investitore-privato/it/site-entry-new?siteEntryAction=ACCEPT&targetUrl=%2Fit%2Finvestitore-privato%2Fit%2Fprodotti%2F251843%2Fishares-euro-high-yield-corporate-bond-ucits-etf%2F1488627371220.ajax%3FsiteEntryPassthrough%3Dtrue%26fileType%3Dcsv%26fileName%3DIHYG_holdings%26dataType%3Dfund%26locale%3Dit_IT%26userType%3Dindividual" "IBOXXMJA Index" "EUR003M Index" "O:/ope/Auto/data/IHYG.csv"
I've also tried the following:
C:\Users\lisa>"C:\Program Files\R\R-3.4.0\bin\Rscript.exe" -e rmarkdown::render('O:/ope/Auto/bin/IHYG.Rmd') --args arg1="https://www.ishares.com/it/investitore-privato/it/site-entry-new?siteEntryAction=ACCEPT&targetUrl=%2Fit%2Finvestitore-privato%2Fit%2Fprodotti%2F251843%2Fishares-euro-high-yield-corporate-bond-ucits-etf%2F1488627371220.ajax%3FsiteEntryPassthrough%3Dtrue%26fileType%3Dcsv%26fileName%3DIHYG_holdings%26dataType%3Dfund%26locale%3Dit_IT%26userType%3Dindividual" arg2="IBOXXMJA Index" arg3="EUR003M Index" arg4="O:/ope/Auto/data/IHYG.csv"
Because I know that the first argument is horribly long, let me split the command line so you can better see each argument:
arg1="https://www.ishares.com/it/investitore-privato/it/site-entry-new?siteEntryAction=ACCEPT&targetUrl=%2Fit%2Finvestitore-privato%2Fit%2Fprodotti%2F251843%2Fishares-euro-high-yield-corporate-bond-ucits-etf%2F1488627371220.ajax%3FsiteEntryPassthrough%3Dtrue%26fileType%3Dcsv%26fileName%3DIHYG_holdings%26dataType%3Dfund%26locale%3Dit_IT%26userType%3Dindividual"
arg2="IBOXXMJA Index"
arg3="EUR003M Index"
arg4="O:/ope/Auto/data/IHYG.csv"
In my R Markdown code chunks, I've set some sink
and write
to log files to keep a trace of what happens: I write the elements belonging to the args
array that comes from args = commandArgs(trailingOnly = TRUE)
.
Here's what I get:
args[1]=https://www.ishares.com/it/investitore-privato/it/site-entry-new?siteEntryAction=ACCEPT
args[2]=NA
args[3]=NA
args[4]=NA
The hyperlink is truncated and I don't understand why, while the other arguments are completely missing.
Any idea?