One of the examples in Rscript.Rd seems mis-formatted, in that the
format statement is incomplete:
## Not run:
Rscript -e 'date()' -e 'format(Sys.time(), "
Both Rscript.Rd in R 2.5.0 and the version at:
https://svn.r-project.org/R/trunk/src/library/utils/man/Rscript.Rd
have
Rscript -e 'date()' -e 'format(Sys.time(), "%a %b %d %X
%Y")'
Do the % need replacing with \% ?
Stephen
> sessionInfo()
R version 2.5.0 (2007-04-23)
i686-pc-linux-gnu
locale:
C
attached base packages:
[1] "stats" "grDevices" "utils"
"datasets" "graphics" "methods"
[7] "base" >
On a similar note the example doesn't seem to work, either, due to
escaping issues:
$ Rscript -e 'format(Sys.time(), "%a %b %d %X %Y")'
ARGUMENT '"%a' __ignored__
ARGUMENT '%b' __ignored__
ARGUMENT '%d' __ignored__
ARGUMENT '%X' __ignored__
ARGUMENT '%Y")' __ignored__
It works only if you remove all spaces from the expression:
$ Rscript -e
'format(Sys.time(),paste("%a","%b","%d","%X","%Y"))'
[1] "Mon Apr 30 10:45:47 AM 2007"
(Tested on i686 Debian etch Linux and Mac OS X 10.4.9 i686; bash,
dash and csh show the same behavior; R 2.5.0 and R-devel 41383).
Although Rscript tries hard to pass the expression as one argument,
it apparently doesn't prevent the shell from not taking it apart when
calling Rexec from R.sh :/
Cheers,
Simon
On Apr 30, 2007, at 10:07 AM, S.J.Eglen at damtp.cam.ac.uk wrote:
> One of the examples in Rscript.Rd seems mis-formatted, in that the
> format statement is incomplete:
>
> ## Not run:
> Rscript -e 'date()' -e 'format(Sys.time(), "
>
> Both Rscript.Rd in R 2.5.0 and the version at:
> https://svn.r-project.org/R/trunk/src/library/utils/man/Rscript.Rd
> have
>
> Rscript -e 'date()' -e 'format(Sys.time(), "%a %b %d %X
%Y")'
>
> Do the % need replacing with \% ?
>
> Stephen
>
>
>
>> sessionInfo()
> R version 2.5.0 (2007-04-23)
> i686-pc-linux-gnu
>
> locale:
> C
>
> attached base packages:
> [1] "stats" "grDevices" "utils"
"datasets" "graphics"
> "methods"
> [7] "base"
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
On Mon, 30 Apr 2007, S.J.Eglen at damtp.cam.ac.uk wrote:> One of the examples in Rscript.Rd seems mis-formatted, in that the > format statement is incomplete: > > ## Not run: > Rscript -e 'date()' -e 'format(Sys.time(), " > > Both Rscript.Rd in R 2.5.0 and the version at: > https://svn.r-project.org/R/trunk/src/library/utils/man/Rscript.Rd > have > > Rscript -e 'date()' -e 'format(Sys.time(), "%a %b %d %X %Y")' > > Do the % need replacing with \% ?Yes, thank you. The other example needs updating, too.> > Stephen > > > >> sessionInfo() > R version 2.5.0 (2007-04-23) > i686-pc-linux-gnu > > locale: > C > > attached base packages: > [1] "stats" "grDevices" "utils" "datasets" "graphics" "methods" > [7] "base" >> > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595