rnw

How do I 'prebuild' a vignette index for an R package?

好久不见. 提交于 2019-11-30 22:44:16
问题 I'm preparing a package for submission to CRAN. I use R CMD build myPackage then R CMD check myPackage --as-cran and it passes all checks with no notes or warnings. However, each time I try to submit, I get the following error message from one of the CRAN maintainers: Package has a VignetteBuilder field but no prebuilt vignette index. As a start, I'd like to be able to reproduce the above error message on my own system ( R version 3.0.1 ). The vignette .Rnw file looks like this: %

Putting line number for R code with knitr

回眸只為那壹抹淺笑 提交于 2019-11-27 14:05:41
I wonder if there is any function to put line numbers with knitr in .Rnw . I found this discussion and some documents (now removed from the web) but could not find the way to put line numbers. This solution uses the LaTeX listings package to create line numbers. I can only get them to work by accumulating across all code chunks, but I imagine there is a similar solution that will enumerate lines only within each chunk. Here's the .Rnw source: \documentclass{article} \usepackage{listings} \begin{document} <<setup, echo=FALSE>>= knit_hooks$set(source = function(x, options) { paste("\\begin

Putting line number for R code with knitr

我与影子孤独终老i 提交于 2019-11-26 22:23:33
问题 I wonder if there is any function to put line numbers with knitr in .Rnw . I found this discussion and some documents (now removed from the web) but could not find the way to put line numbers. 回答1: This solution uses the LaTeX listings package to create line numbers. I can only get them to work by accumulating across all code chunks, but I imagine there is a similar solution that will enumerate lines only within each chunk. Here's the .Rnw source: \documentclass{article} \usepackage{listings}

r knitr chunk options for figure height / width are not working

纵然是瞬间 提交于 2019-11-26 16:47:23
I used to use knitr in R to produce reports from the .Rnw format. In my reports I often put a plenty of plots and manipulated their size with the use of chunk optios, e.g.: \begin{figure}[h!] \centering <<fig.width=6, fig.height=4, out.width='.89\\linewidth'>>= plot(mtcars) @ \caption{} \end{figure} It was few months ago. Then I moved to another environment, reinstalled R and these options seem no longer work - the plot size stays unchanged on the PDF output ! Here comes all the lines of code regarding any option settings. I am looking forward any suggestions what am I doing wrong. << >>=

r knitr chunk options for figure height / width are not working

半腔热情 提交于 2019-11-26 08:51:49
问题 I used to use knitr in R to produce reports from the .Rnw format. In my reports I often put a plenty of plots and manipulated their size with the use of chunk optios, e.g.: \\begin{figure}[h!] \\centering <<fig.width=6, fig.height=4, out.width=\'.89\\\\linewidth\'>>= plot(mtcars) @ \\caption{} \\end{figure} It was few months ago. Then I moved to another environment, reinstalled R and these options seem no longer work - the plot size stays unchanged on the PDF output ! Here comes all the lines