[R] Adding an Sweave Vignette to a package

Doran, Harold HDoran at air.org
Tue Jan 22 15:04:46 CET 2008


Actually, I'm running 2.6.1. The old version is in the path, but I am
working with the most recent version. I am working in DOS and am at the
prompt c:\program files\r\r-2.6.1\bin. From here I do all of the work in
building the package (build, check, install).

> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
> Sent: Tuesday, January 22, 2008 9:02 AM
> To: Doran, Harold
> Cc: R Help
> Subject: Re: [R] Adding an Sweave Vignette to a package
> 
> 
> 
> Doran, Harold wrote:
> > Thanks, Uwe. Before I modify this path, I want to make sure of one 
> > thing. My path is set according to the specifications in 
> the document 
> > prescribed by Duncan Murdoch (at link below). Indeed, my 
> path includes 
> > the proper location of my MikTex and pdflatex.exe files. Here is my 
> > path from the command you gave below:
> > 
> > 
> "c:\\Rtools\\bin;C:\\Perl\\bin\\;c:\\Rtools\\MinGW\\bin;c:\\texmf\\mik
> > te
> > 
> k\\bin;c:\\cygwin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\Syste
> > m3 2\\Wbem;C:\\subversion\\Subversion\\bin;C:\\Program
> > Files\\R\\R-2.2.0\\bin; " 
> > 
> > 
> http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset
> > 
> > AFAIK, the path indeed is set according to the Murdoch prescription 
> > for building R packages, my pdflatex.exe lives in the directory 
> > pointed to in this path, yet R cannot see it when doing Rcmd build.
> > 
> > I can successfully build and use the package at this point 
> (again as 
> > my other problem now solved). However, I am not sure what I should 
> > work on to resolve the issue of building the vignette.
> > 
> > There are so many steps in building a package, I may have missed 
> > something somewhere. So, if you see an error I appreciate 
> any advice.
> 
> Hmm, hard to tell, although I think it might make sense to 
> upgrade your version of R, given I am correct that you are 
> running R-2.2.0 (from the output you gave above).
> 
> Uwe
> 
> 
> > Harold
> > 
> > 
> >> -----Original Message-----
> >> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de]
> >> Sent: Tuesday, January 22, 2008 4:15 AM
> >> To: Doran, Harold
> >> Cc: James W. MacDonald; R Help
> >> Subject: Re: [R] Adding an Sweave Vignette to a package
> >>
> >> In R, type
> >>   Sys.getenv("PATH")
> >> and you will probably find that the PATH does not include 
> the path of 
> >> the pdflatex executable of the mikTeX distribution.
> >>
> >> Uwe
> >>
> >>
> >> Doran, Harold wrote:
> >>> Jim
> >>>
> >>> First thanks for your patience. I use MikTex as well. I do
> >> have both
> >>> (texti2dvi and pdflatex) on my local machine. I copied and
> >> pasted the
> >>> code below and stepped through it. I think this break 
> down with the 
> >>> following error. Indeed, I think there is a path problem.
> >>>
> >>> However, I don't see a resolution in either Writing R 
> Extensions or 
> >>> the Leisch paper. So, I'm not quite sure what path to
> >> modify and/or how.
> >>> Error in texi2dvi("TheVignette.tex", pdf = TRUE) : 
> >>>   unable to run pdflatex on 'TheVignette.tex'
> >>> In addition: Warning message:
> >>> In system(paste(shQuote(latex), "-interaction=nonstopmode",
> >> texfile)) :
> >>>   "pdflatex" not found
> >>>
> >>>> -----Original Message-----
> >>>> From: James W. MacDonald [mailto:jmacdon at med.umich.edu]
> >>>> Sent: Monday, January 21, 2008 4:53 PM
> >>>> To: Doran, Harold
> >>>> Cc: R Help
> >>>> Subject: Re: [R] Adding an Sweave Vignette to a package
> >>>>
> >>>> What TeX variant are you using? If texi2dvi() can't find
> >> texi2dvi, it
> >>>> tries to fall back on pdflatex which has to be in the path.
> >>>>
> >>>> I have always had good luck with MikTeX, which does have 
> texi2dvi.
> >>>>
> >>>> You could always try
> >>>>
> >>>> library(tools)
> >>>> Sweave("TheVignette.Rnw")
> >>>> debug(texi2dvi)
> >>>> texi2dvi("TheVignette.tex", pdf=TRUE)
> >>>>
> >>>> and step through to see where it fails, although on the 
> surface it 
> >>>> looks like a path problem.
> >>>>
> >>>> Best,
> >>>>
> >>>> Jim
> >>>>
> >>>>
> >>>>
> >>>> Doran, Harold wrote:
> >>>>> There is now and it looks like I got through the first
> >>>> phase. But, now
> >>>>> I get the error below.
> >>>>>
> >>>>> * DONE (MiscPsycho)
> >>>>> * creating vignettes ... ERROR
> >>>>> Loading required package: statmod
> >>>>> Below is what alpha *would be* if the item were removed
> >>>>>
> >>>>> Error in texi2dvi(file = bft, pdf = TRUE, clean = FALSE, quiet =
> >>>>> quiet)
> >>>>> :
> >>>>>   unable to run pdflatex on 'MP.tex'
> >>>>> Calls: buildVignettes -> texi2dvi
> >>>>> In addition: Warning messages:
> >>>>> 1: In readLines(f[1]) : incomplete final line found on 'MP.Rnw'
> >>>>> 2: In system(paste(shQuote(latex), "-interaction=nonstopmode",
> >>>>> texfile))
> >>>>> :
> >>>>>   "pdflatex" not found
> >>>>> Execution halted
> >>>>>
> >>>>> I do have pdflatex, it's what I use all of the time. 
> >>>> However, how do I
> >>>>> point to it for this build process?
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: James W. MacDonald [mailto:jmacdon at med.umich.edu]
> >>>>>> Sent: Monday, January 21, 2008 4:09 PM
> >>>>>> To: Doran, Harold
> >>>>>> Cc: R Help
> >>>>>> Subject: Re: [R] Adding an Sweave Vignette to a package
> >>>>>>
> >>>>>> Hi Harold,
> >>>>>>
> >>>>>> Doran, Harold wrote:
> >>>>>>> I'm finalizing development of a package that will include a
> >>>>>> vignette.
> >>>>>>> Without the vignette, the package builds fine with no
> >>>>>> warnings and is
> >>>>>>> ready for distribution. Now, I am following the 
> directions for 
> >>>>>>> developing vignettes "Sweave, Part II: Package Vignettes"
> >>>>>> by Friedrich
> >>>>>>> Leisch.
> >>>>>>>
> >>>>>>> I am using a windows XP machine (other session info
> >>>> below). Here is
> >>>>>>> what I have done.
> >>>>>>>
> >>>>>>> 1) I add the 'inst/doc' directory to the package source tree.
> >>>>>>> 2) I have added the following information in the preamble
> >>>>>> of the .Rnw
> >>>>>>> file
> >>>>>>>
> >>>>>>> % \VignetteIndexEntry{An \texttt{R} Package for Miscellaneous 
> >>>>>>> Psychometric Analyses} % \VignetteDepends{MiscPsycho,
> >> statmod} %
> >>>>>>> \VignetteKeyword{misc}
> >>>>>>>
> >>>>>>> 3) I then copy the file "MP.Rnw" to the 'inst/doc' directory.
> >>>>>>> 4) I then run Rcmd build g:\MiscPsycho
> >>>>>>>
> >>>>>>> The process begins as usual and it even tries to create the
> >>>>>> vignette.
> >>>>>>> However, it runs into an error at code chunk 1
> >>>> complaining that it
> >>>>>>> cannot find the function called simRasch(). This simRasch
> >>>>>> function is
> >>>>>>> one of the functions developed for this package and one
> >> that will
> >>>>>>> exist only when the package is built. The build process
> >> is halted.
> >>>>>>> I'm not sure how to handle this. Any advice is appreciated.
> >>>>>> Is there a library(MiscPsycho) at the beginning of that
> >> code chunk?
> >>>>>> Best,
> >>>>>>
> >>>>>> Jim
> >>>>>>
> >>>>>>
> >>>>>>> Harold
> >>>>>>>
> >>>>>>>> sessionInfo()
> >>>>>>> R version 2.6.1 (2007-11-26)
> >>>>>>> i386-pc-mingw32
> >>>>>>>
> >>>>>>> locale:
> >>>>>>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> >>>>>>> States.1252;LC_MONETARY=English_United
> >>>>>>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> >>>>>>>
> >>>>>>> attached base packages:
> >>>>>>> [1] stats     graphics  grDevices utils     datasets  
> >>>> methods   base
> >>>>>>> other attached packages:
> >>>>>>> [1] statmod_1.3.3
> >>>>>>>
> >>>>>>> loaded via a namespace (and not attached):
> >>>>>>> [1] tools_2.6.1
> >>>>>>>
> >>>>>>> ______________________________________________
> >>>>>>> R-help at r-project.org mailing list 
> >>>>>>> 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.
> >>>>>> --
> >>>>>> James W. MacDonald, M.S.
> >>>>>> Biostatistician
> >>>>>> Affymetrix and cDNA Microarray Core University of
> >> Michigan Cancer
> >>>>>> Center 1500 E. Medical Center Drive 7410 CCGC Ann 
> Arbor MI 48109
> >>>>>> 734-647-5623
> >>>>>>
> >>>> --
> >>>> James W. MacDonald, M.S.
> >>>> Biostatistician
> >>>> Affymetrix and cDNA Microarray Core University of 
> Michigan Cancer 
> >>>> Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109
> >>>> 734-647-5623
> >>>>
> >>> ______________________________________________
> >>> R-help at r-project.org mailing list
> >>> 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.
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > 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.
> 



More information about the R-help mailing list