From cstrato at aon.at  Thu Aug 29 22:52:09 2013
From: cstrato at aon.at (cstrato)
Date: Thu, 29 Aug 2013 22:52:09 +0200
Subject: [Rd] Error when using buildVignettes()
In-Reply-To: <CAFDcVCQbhehTVOn0tvjokdkf2Q83DvLDBTnsRfdzdKYZ=1N+iw@mail.gmail.com>
References: <521E5076.9020106@aon.at>
	<CAFDcVCSGCkxqYMC9MJAyLY6ybby6qX3mg+P97dX1yKA4ap7qFg@mail.gmail.com>
	<521E753F.5030708@aon.at>
	<CAFDcVCQbhehTVOn0tvjokdkf2Q83DvLDBTnsRfdzdKYZ=1N+iw@mail.gmail.com>
Message-ID: <521FB479.4010908@aon.at>

Dear Henrik,

Thank you for your extensive reply, using:

Sweave("QAReport.Rnw")
tools::texi2pdf("QAReport.tex", clean = TRUE)

did solve my problem.

Nevertheless, I do not understand why function buildVignettes() was 
modified in a way that it can no longer be used to create vignettes for 
testing purposes w/o a DESCRIPTION file. This is also nowhere mentioned 
in the R News file. The only comment is: "If there is a field 
BuildVignettes in the package ?DESCRIPTION? file with a false value, 
re-building the vignettes is skipped." It would be easy to simply use 
true as default if there is no DESCRIPTION file is present.

Best regards,
Christian


On 8/29/13 12:58 AM, Henrik Bengtsson wrote:
> Ok.  ...I've now read your original thread more carefully, and I'd say
> that tools::buildVignettes() is intended for building vignettes within
> packages, not for compiling vignette files in general.  This is most
> likely why it complains - it simply looks for files that it expect to
> see in a package source tree.  FYI, lots of changes were made to these
> tools in R 3.0.0, which may explain why you didn't see them before
> (not saying it was correct usage before either).
>
> I'd say, use Sweave/Stangle "manually" and then pass it on to tools::texi2pdf().
>
> <sales pitch>
> 1. For *.Rnw -> *.tex -> *.pdf, you can use R.rsp::compileRnw() that
> does all this in one go with more sanity checks.
>
> 2. Instead of using all those sub("@TITLE@",  title, ...) coding to
> generate the report Rnw from a main Rnw template, add a layer of RSP
> markup and run it through the RSP compiler.  For instance, with a
> template.Rnw.rsp containing:
>
>   This is the quality assessment report for the dataset '<%=dataset%>'.
> The dataset consists of
>   <%=numtrees%> Affymetrix <%=chiptype%> arrays of type '<%=chipname%>'.
>
> you can compile it all in one go into a final PDF by pdf <-
> R.rsp::rfile("template.Rnw.rsp").  RSP supports <%@include
> file="..."%> statements and more if you wish to bring multiple Rnw
> templates into a final one.  See help("R.rsp") for vignettes etc.
> </sales pitch>
>
> On Wed, Aug 28, 2013 at 3:10 PM, cstrato <cstrato at aon.at> wrote:
>> Dear Henrik,
>>
>> Thank you for your suggestion, however the error was detected by a user who
>> is already using R 3.0.1, see:
>> https://www.stat.math.ethz.ch/pipermail/bioconductor/2013-August/054633.html
>>
>> Best regards,
>> Christian
>>
>>
>>
>> On 8/28/13 11:49 PM, Henrik Bengtsson wrote:
>>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 3.0.0 Patched (2013-04-11 r62551)
>>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>
>>>
>>> I would check with R 3.0.1 patched and R devel before anything else,
>>> especially when troubleshooting vignette-related issues.
>>>
>>> /Henrik
>>>
>>>
>>> On Wed, Aug 28, 2013 at 12:33 PM, cstrato <cstrato at aon.at> wrote:
>>>>
>>>> Dear all,
>>>>
>>>> When running function 'testQAReport()', which uses function
>>>> 'buildVignettes()' to create a pdf-file I get the following error:
>>>>
>>>>> source("testQAReport.R")
>>>>> testQAReport()
>>>>
>>>> Error in .get_package_metadata(pkgdir) :
>>>>     Files 'DESCRIPTION' and 'DESCRIPTION.in' are missing.
>>>>
>>>> Since I did not get this error in earlier versions of R, could you please
>>>> tell me what may be the reason for this error?
>>>>
>>>>
>>>> Here is the code for "testQAReport.R":
>>>>
>>>>
>>>> #------------------------------------------------------------------------------#
>>>> # testQAReport.R: test quality control report
>>>> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>> -
>>>> - -
>>>> testQAReport <-
>>>> function(dataset     = "My Dataset",
>>>>            title       = "Quality Report",
>>>>            date        = "October, 2011",
>>>>            author      = "Christian Stratowa",
>>>>            outdir      = file.path(getwd(), "TestQA"),
>>>>            ...)
>>>> {
>>>>      ## directory containing parts of QAReport.Rnw
>>>>      indir <- file.path(path.package("xps"), "QC");
>>>>
>>>>      ## create directory containing final QAReport.Rnw
>>>>      if (!dir.create(outdir))
>>>>         stop("could not create report directory");
>>>>      if (!dir.create(file.path(outdir, "inst")))
>>>>         stop("could not create report subdirectory 'inst'");
>>>>      if (!dir.create(file.path(outdir, "inst", "doc")))
>>>>         stop("could not create report subdirectory 'doc'");
>>>>      docdir <- file.path(outdir, "inst", "doc");
>>>>
>>>>      QCb <- readLines(file.path(indir, "QC.begin.Rnw"));
>>>>
>>>>      ## replace title, date, author
>>>>      QCb <- sub("@TITLE@",  title,  QCb);
>>>>      QCb <- sub("@DATE@",   date,   QCb);
>>>>      QCb <- sub("@AUTHOR@", author, QCb);
>>>>
>>>>      ## dataset info
>>>>      numtrees <- 6; chipname <- "Test3"; chiptype <- "GeneChip";
>>>>      QCb <- sub("@DATASET@",  dataset,  QCb);
>>>>      QCb <- sub("@NUMTREES@", numtrees, QCb);
>>>>      QCb <- sub("@CHIPNAME@", chipname, QCb);
>>>>      QCb <- sub("@CHIPTYPE@", chiptype, QCb);
>>>>
>>>>      write(QCb, file.path(docdir, "QAReport.Rnw"));
>>>>
>>>>      QCe <- readLines(file.path(indir, "QC.end.Rnw"));
>>>>      QCe <- sub("@DATASET@",  dataset,  QCe);
>>>>      QCe <- gsub("_","\\\\_", QCe);
>>>>
>>>>      write(QCe, file.path(docdir, "QAReport.Rnw"), append=TRUE);
>>>>
>>>>      ## build vignette QC.pdf
>>>>      if (require(tools)) {
>>>>         buildVignettes(dir=outdir, lib.loc=NULL, quiet=FALSE,
>>>> clean=FALSE);
>>>>      }#if
>>>> }#xpsQAReport
>>>>
>>>>
>>>> #------------------------------------------------------------------------------#
>>>>
>>>> The file "QC.begin.Rnw" is as follows:
>>>>
>>>> \documentclass{article}
>>>>
>>>>
>>>> \textwidth=6.2in
>>>> \textheight=8.5in
>>>> %\parskip=.3cm
>>>> \oddsidemargin=.1in
>>>> \evensidemargin=.1in
>>>> \headheight=-.3in
>>>>
>>>> \newcommand{\Rfunction}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rmethod}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rcode}[1]{{\texttt{#1}}}
>>>> \newcommand{\Robject}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rpackage}[1]{{\textsf{#1}}}
>>>> \newcommand{\Rclass}[1]{{\textit{#1}}}
>>>> \newcommand{\Cclass}[1]{{\textit{#1}}}
>>>> \newcommand{\Rexten}[1]{{\textit{#1}}}
>>>> \newcommand{\xps}{\Rpackage{xps}}
>>>> \newcommand{\ROOT}{\Robject{ROOT}}
>>>>
>>>> \begin{document}
>>>>
>>>> \title{@TITLE@}
>>>> \date{@DATE@}
>>>> \author{@AUTHOR@}
>>>> \maketitle
>>>>
>>>> \tableofcontents
>>>>
>>>>
>>>> \section{Introduction}
>>>>
>>>>    This is the quality assessment report for the dataset '@DATASET@'. The
>>>> dataset consists of
>>>>    @NUMTREES@ Affymetrix @CHIPTYPE@ arrays of type '@CHIPNAME@'. \\
>>>>
>>>>    This report was generated using function \Rfunction{xpsQAReport} of
>>>> package
>>>> \xps. \\
>>>>
>>>>
>>>> The file "QC.end.Rnw" is as follows:
>>>>
>>>> \section{Summary}
>>>>
>>>>    The current quality report for dataset '@DATASET@' displays the most
>>>> important quality plots, using the
>>>>    default settings for most plots. Package \xps\ contains additional
>>>> plots
>>>> which can be used for further
>>>>    quality assessments. \\
>>>>
>>>>
>>>> \section*{Session Information:}
>>>>
>>>> <<echo=FALSE>>=
>>>> sessionInfo()
>>>> @
>>>>
>>>> \end{document}
>>>>
>>>>
>>>> Finally, the output which is located in TestQA/inst/doc/QAReport.Rnw is
>>>> as
>>>> follows:
>>>>
>>>> \documentclass{article}
>>>>
>>>>
>>>> \textwidth=6.2in
>>>> \textheight=8.5in
>>>> %\parskip=.3cm
>>>> \oddsidemargin=.1in
>>>> \evensidemargin=.1in
>>>> \headheight=-.3in
>>>>
>>>> \newcommand{\Rfunction}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rmethod}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rcode}[1]{{\texttt{#1}}}
>>>> \newcommand{\Robject}[1]{{\texttt{#1}}}
>>>> \newcommand{\Rpackage}[1]{{\textsf{#1}}}
>>>> \newcommand{\Rclass}[1]{{\textit{#1}}}
>>>> \newcommand{\Cclass}[1]{{\textit{#1}}}
>>>> \newcommand{\Rexten}[1]{{\textit{#1}}}
>>>> \newcommand{\xps}{\Rpackage{xps}}
>>>> \newcommand{\ROOT}{\Robject{ROOT}}
>>>>
>>>> \begin{document}
>>>>
>>>> \title{Quality Report}
>>>> \date{October, 2011}
>>>> \author{Christian Stratowa}
>>>> \maketitle
>>>>
>>>> \tableofcontents
>>>>
>>>>
>>>> \section{Introduction}
>>>>
>>>>    This is the quality assessment report for the dataset 'My Dataset'. The
>>>> dataset consists of
>>>>    6 Affymetrix GeneChip arrays of type 'Test3'. \\
>>>>
>>>>    This report was generated using function \Rfunction{xpsQAReport} of
>>>> package
>>>> \xps. \\
>>>>
>>>> \section{Summary}
>>>>
>>>>    The current quality report for dataset 'My Dataset' displays the most
>>>> important quality plots, using the
>>>>    default settings for most plots. Package \xps\ contains additional
>>>> plots
>>>> which can be used for further
>>>>    quality assessments. \\
>>>>
>>>>
>>>> \section*{Session Information:}
>>>>
>>>> <<echo=FALSE>>=
>>>> sessionInfo()
>>>> @
>>>>
>>>> \end{document}
>>>>
>>>>
>>>> Can you please tell me why function buildVignettes() of the tools package
>>>> is
>>>> no longer able to convert this file into a pdf-file?
>>>> Thank you in advance.
>>>>
>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 3.0.0 Patched (2013-04-11 r62551)
>>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>>
>>>> locale:
>>>> [1] C
>>>>
>>>> attached base packages:
>>>> [1] tools     stats     graphics  grDevices utils     datasets  methods
>>>> [8] base
>>>>
>>>> other attached packages:
>>>> [1] xps_1.21.4
>>>>
>>>> Best regards
>>>> Christian
>>>> _._._._._._._._._._._._._._._._._._
>>>> C.h.r.i.s.t.i.a.n   S.t.r.a.t.o.w.a
>>>> V.i.e.n.n.a           A.u.s.t.r.i.a
>>>> e.m.a.i.l:        cstrato at aon.at
>>>> _._._._._._._._._._._._._._._._._._
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>>
>



[Rd] Error when using buildVignettes()
cstrato