Quantcast

R CMD Sweave versus Sweave() on Windows

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

R CMD Sweave versus Sweave() on Windows

Pfaff, Bernhard Dr.
Dear list subscriber,

I am quite puzzled by the behaviour of processing Sweave files within an R session, i.e.
Sweave("foo.Rnw") versus R CMD Sweave foo.Rnw

In the former the environmental variable 'SWEAVE_STYLEPATH_DEFAULT = TRUE' is obeyed (this is set in etc/Renviron.site as well as under the users home directory in .Renviron). That is the hard-coded path to Sweave.sty is included in the resultant tex-file, whereas if the Sweave file is processed from cmd.exe as R CMD Sweave foo.Rnw, only \usepackage{Sweave} is included.

Any pointers are much appreciated.
Best,
Bernhard

Output of sessionInfo():
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252  
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                  
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  datasets  grDevices utils     methods   base    

other attached packages:
[1] fortunes_1.4-1


Dr. Bernhard Pfaff
Director
Global Asset Allocation

Invesco Asset Management Deutschland GmbH
An der Welle 5
D-60322 Frankfurt am Main

Tel: +49 (0)69 29807 230
Fax: +49 (0)69 29807 178
www.institutional.invesco.com
Email: [hidden email]

Geschäftsführer: Karl Georg Bayer, Bernhard Langer, Dr. Jens Langewand, Alexander Lehmann, Christian Puschmann
Handelsregister: Frankfurt am Main, HRB 28469
Sitz der Gesellschaft: Frankfurt am Main

 
*****************************************************************
Confidentiality Note: The information contained in this ...{{dropped:10}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R CMD Sweave versus Sweave() on Windows

Kasper Daniel Hansen-2
Bernd

.Renviron is not being read when you do R CMD ...  This is documented,
but still puzzling to me.  I solved this by using
  Sys.setenv("SWEAVE_STYLEPATH_DEFAULT" = "TRUE")
in my .Rprofile (which is being read by R CMD ...).  If you were on
linux you could also put it inside your shell profile (like ,.bashrc).

Kasper

On Thu, Apr 21, 2011 at 6:44 AM, Pfaff, Bernhard Dr.
<[hidden email]> wrote:

> Dear list subscriber,
>
> I am quite puzzled by the behaviour of processing Sweave files within an R session, i.e.
> Sweave("foo.Rnw") versus R CMD Sweave foo.Rnw
>
> In the former the environmental variable 'SWEAVE_STYLEPATH_DEFAULT = TRUE' is obeyed (this is set in etc/Renviron.site as well as under the users home directory in .Renviron). That is the hard-coded path to Sweave.sty is included in the resultant tex-file, whereas if the Sweave file is processed from cmd.exe as R CMD Sweave foo.Rnw, only \usepackage{Sweave} is included.
>
> Any pointers are much appreciated.
> Best,
> Bernhard
>
> Output of sessionInfo():
>> sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
> [5] LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] stats     graphics  datasets  grDevices utils     methods   base
>
> other attached packages:
> [1] fortunes_1.4-1
>
>
> Dr. Bernhard Pfaff
> Director
> Global Asset Allocation
>
> Invesco Asset Management Deutschland GmbH
> An der Welle 5
> D-60322 Frankfurt am Main
>
> Tel: +49 (0)69 29807 230
> Fax: +49 (0)69 29807 178
> www.institutional.invesco.com
> Email: [hidden email]
>
> Geschäftsführer: Karl Georg Bayer, Bernhard Langer, Dr. Jens Langewand, Alexander Lehmann, Christian Puschmann
> Handelsregister: Frankfurt am Main, HRB 28469
> Sitz der Gesellschaft: Frankfurt am Main
>
>
> *****************************************************************
> Confidentiality Note: The information contained in this ...{{dropped:10}}
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R CMD Sweave versus Sweave() on Windows

Prof Brian Ripley
In reply to this post by Pfaff, Bernhard Dr.
On Thu, 21 Apr 2011, Pfaff, Bernhard Dr. wrote:

> Dear list subscriber,
>
> I am quite puzzled by the behaviour of processing Sweave files within an R session, i.e.
> Sweave("foo.Rnw") versus R CMD Sweave foo.Rnw
>
> In the former the environmental variable 'SWEAVE_STYLEPATH_DEFAULT =
> TRUE' is obeyed (this is set in etc/Renviron.site as well as under
> the users home directory in .Renviron). That is the hard-coded path
> to Sweave.sty is included in the resultant tex-file, whereas if the
> Sweave file is processed from cmd.exe as R CMD Sweave foo.Rnw, only
> \usepackage{Sweave} is included.
>
> Any pointers are much appreciated.
R CMD Sweave does not read the startup files.  Try runnning
R --vanilla and Sweave("foo.Rnw"): you will see the same.

> Best,
> Bernhard
>
> Output of sessionInfo():
>> sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
> [5] LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] stats     graphics  datasets  grDevices utils     methods   base
>
> other attached packages:
> [1] fortunes_1.4-1
>
>
> Dr. Bernhard Pfaff
> Director
> Global Asset Allocation
>
> Invesco Asset Management Deutschland GmbH
> An der Welle 5
> D-60322 Frankfurt am Main
>
> Tel: +49 (0)69 29807 230
> Fax: +49 (0)69 29807 178
> www.institutional.invesco.com
> Email: [hidden email]
>
> Geschäftsführer: Karl Georg Bayer, Bernhard Langer, Dr. Jens Langewand, Alexander Lehmann, Christian Puschmann
> Handelsregister: Frankfurt am Main, HRB 28469
> Sitz der Gesellschaft: Frankfurt am Main
>
>
> *****************************************************************
> Confidentiality Note: The information contained in this ...{{dropped:10}}
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley,                  [hidden email]
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
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R CMD Sweave versus Sweave() on Windows

Pfaff, Bernhard Dr.
>
> On Thu, 21 Apr 2011, Pfaff, Bernhard Dr. wrote:
>
> > Dear list subscriber,
> >
> > I am quite puzzled by the behaviour of processing Sweave
> files within an R session, i.e.
> > Sweave("foo.Rnw") versus R CMD Sweave foo.Rnw
> >
> > In the former the environmental variable
> 'SWEAVE_STYLEPATH_DEFAULT =
> > TRUE' is obeyed (this is set in etc/Renviron.site as well
> as under the
> > users home directory in .Renviron). That is the hard-coded path to
> > Sweave.sty is included in the resultant tex-file, whereas if the
> > Sweave file is processed from cmd.exe as R CMD Sweave foo.Rnw, only
> > \usepackage{Sweave} is included.
> >
> > Any pointers are much appreciated.
>
> R CMD Sweave does not read the startup files.  Try runnning R
> --vanilla and Sweave("foo.Rnw"): you will see the same.

Dear Prof. Ripley,

many thanks for your swift reply. This is indeed correct and educative --thanks for this; but now I am kind of curious where this different behaviour compared to version 2.12.0 has been announced or can be found? I have read the NEWS file and the Windows specific NEWS of the latest release, but was not able to find any pointer. That is, if I issue 'R CMD Sweave foo.Rnw' in cmd.exe with R version 2.12.0, the hard-coded path to Sweave.sty is included and hence environmental variables contained in the startup files are read.
Asked differently, is there a way such that R CMD Sweave does read the startup files under R 2.13.0?

re: Kasper, many thanks for your reply. Incidentally, I have had 'Sys.setenv("SWEAVE_STYLEPATH_DEFAULT" = "TRUE")' directive already included in my .Rprofile, but as Prof. Ripley correcly pointed out, these settings are not taken effect.

Best,
Bernhard  



>
> > Best,
> > Bernhard
> >
> > Output of sessionInfo():
> >> sessionInfo()
> > R version 2.13.0 (2011-04-13)
> > Platform: i386-pc-mingw32/i386 (32-bit)
> >
> > locale:
> > [1] LC_COLLATE=German_Germany.1252  
> LC_CTYPE=German_Germany.1252 [3]
> > LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5]
> > LC_TIME=German_Germany.1252
> >
> > attached base packages:
> > [1] stats     graphics  datasets  grDevices utils     methods   base
> >
> > other attached packages:
> > [1] fortunes_1.4-1
> >
> >
> > Dr. Bernhard Pfaff
> > Director
> > Global Asset Allocation
> >
> > Invesco Asset Management Deutschland GmbH An der Welle 5
> > D-60322 Frankfurt am Main
> >
> > Tel: +49 (0)69 29807 230
> > Fax: +49 (0)69 29807 178
> > www.institutional.invesco.com
> > Email: [hidden email]
> >
> > Geschäftsführer: Karl Georg Bayer, Bernhard Langer, Dr. Jens
> > Langewand, Alexander Lehmann, Christian Puschmann
> > Handelsregister: Frankfurt am Main, HRB 28469 Sitz der
> Gesellschaft:
> > Frankfurt am Main
> >
> >
> > *****************************************************************
> > Confidentiality Note: The information contained in this
> > ...{{dropped:10}}
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> --
> Brian D. Ripley,                  [hidden email]
> 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
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: R CMD Sweave versus Sweave() on Windows

Gabor Grothendieck
In reply to this post by Pfaff, Bernhard Dr.
On Thu, Apr 21, 2011 at 6:44 AM, Pfaff, Bernhard Dr.
<[hidden email]> wrote:

> Dear list subscriber,
>
> I am quite puzzled by the behaviour of processing Sweave files within an R session, i.e.
> Sweave("foo.Rnw") versus R CMD Sweave foo.Rnw
>
> In the former the environmental variable 'SWEAVE_STYLEPATH_DEFAULT = TRUE' is obeyed (this is set in etc/Renviron.site as well as under the users home directory in .Renviron). That is the hard-coded path to Sweave.sty is included in the resultant tex-file, whereas if the Sweave file is processed from cmd.exe as R CMD Sweave foo.Rnw, only \usepackage{Sweave} is included.
>
> Any pointers are much appreciated.
> Best,
> Bernhard
>
> Output of sessionInfo():
>> sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
> [5] LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] stats     graphics  datasets  grDevices utils     methods   base
>
> other attached packages:
> [1] fortunes_1.4-1
>

SWEAVE_STYLEPATH_DEFAULT is automatically set in Sweave.bat found here
(its part of the batchfiles distribution but does not require any
other batch file in order to run it):

http://batchfiles.googlecode.com/svn/trunk/Sweave.bat

This was only just added and has not been tested yet but if anyone
would like to try it just put it anywhere on your Windows PATH (or
current directory) and issue a command like this from the Windows
console:

   Sweave myfile.Rnw



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...