r-markdown

knitr doesn't know new function (r-markdown)

眉间皱痕 提交于 2019-12-02 03:04:28
I have a problem regarding the HTML-output with knitr (r-markdown). I worked with the function gamlss from the package "gamlss", but knitr cannot find this function/package. So when I try to make an output with "Knit HTML", it just appears an error message: "(error in eval(expr, envir, enclos) : couldnt find Function "gamlss" Calls: ... handle -> withCallingHandlers -> withVisible -> eval -> eval implementation stopped. " Has anybody ever dealt with a similar problem? darkage you have to load the package in the markdown file as well ```{r,echo=FALSE} library(gamlss) **rest of the code** ``` 来源

Disaggregate in the context of a time series

瘦欲@ 提交于 2019-12-02 02:31:07
I have a dataset that I want to visualize overall and disaggregated by a few different variables. I created a flexdashboard with a toy shiny app to select the type of disaggregation, and working code to plot the correct subset. My approach is repetitive, which is a hint to me that I'm missing out on a better way to do this. The piece that's tripping me up is the need to count by date and expand the matrix. I'm not sure how get group counts by week in one pipe. I do it in several steps and combine. Thoughts? (ps. I asked this question on RStudio Community , but I think it's probably more of a "

Bookdown add URL as footnote

我的梦境 提交于 2019-12-02 01:34:22
I am having problems getting correct pdf output of figure legends that contain a url. It works as bookdown::gitbook but not as bookdown::pdf_book Here is an example: --- output: bookdown::pdf_book --- ## Reference with URL doesn't work In this experiment, we will use a [spectrophotometer] (https://en.wikipedia.org/wiki/Spectrophotometry) to measure the absorption of light of different wavelength by colored solutions. (ref:spectrum) [Spectrum of light. V, violet; B, blue; G, green Y, yellow; O, orange; R, red](https://commons.wikimedia.org/wiki/File:Linear_visible_spectrum.svg) ```{r spectrum,

Table of multiple lm() models using apsrtable in Rmarkdown

故事扮演 提交于 2019-12-02 01:16:27
Goal Present the results of multiple models, created using the lm() function, together in a nicely-formatted table. This table will be generated in a .Rmd file and output to a PDF document. Proposed Solution In Reproducible Research with R and RStudio , there is an example using the apsrtable() function to display multiple models side-by-side. This book provides the following code (p. 173-174): Code \begin{table} \caption{Example Nested Estimates Table with \emph{aprstable}} \label{BasicApsrTableExample} \begin{center} <<results= asis , echo=FALSE>>= # Load apsrtable package library(apsrtable)

Fonts for Rmarkdown document

久未见 提交于 2019-12-02 01:04:37
Here is a minimal working example. --- date : 2018-May-26 output: pdf_document title: "Testing Rmarkdown" --- ```{r,comment = NA} Gender <- gl(2,1000,labels = c("Men","Women")) SmokerM <- sample(c("Y","N"),1000,replace = T , prob = c(.3,.7)) SmokerW <- sample(c("Y","N"),1000,replace = T , prob = c(.5,.5)) Smoker <- c(SmokerM,SmokerW) mydata <- data.frame(Gender,Smoker) table(mydata$Gender,mydata$Smoker) ``` This is a text in the body of the document.What font is this ? What is font for the output of table ? How can we change these 2 fonts ? What other categories of items are there in an

How to render leaflet-maps in loops in RMDs with knitr

筅森魡賤 提交于 2019-12-02 00:44:00
问题 I am currently fighting trying to get knitr to render my leaflet maps, taken from a collection to appear correctly in a rendered RMD html-output. I'm already aware about some potential problems when looping throug collections and generating graphical output with RMD/knitr, but still I can't figure out, how to make my example work for leaflet-maps. Reproducible working example (Test_1.Rmd) : --- title: "test1" author: "phabee" date: "22 Mai 2018" output: html_document --- ```{r setup, include

How to add a latex package to R Journal template from rticle package in R

久未见 提交于 2019-12-01 22:23:36
I am using rticle package by RStudio to write an article in R using rmarkdown package. In the draft template there is an option ... preamble: > % Any extra latex you need in the preamble output: rticles::rjournal_article ... Where I suspect I can add lines like \usepackage{package_name} or set a file name in which I load all desired Latex packages. The first approach I've tried to add one single package to preamble section like this but have stacked on an error --- title: Capitalized Title Here author: - name: Author One affiliation: Affiliation address: - line 1 - line 2 email: author1@work -

Rottation of R 3d plots not working properly with knitr and webgl

假如想象 提交于 2019-12-01 22:20:42
问题 I am trying to use rgl knitr and webgl to plot several interactive 3d plots in a sequence. And I am getting quite a weird behavior: when trying to rotate the plots with a mouse they seem to get back to their initial position after each mouse drag. This makes the interaction quite unintuitive. I noticed that the last plot on a page is not affected by this, but all the rest are. This can be seen on the original knitr example: source: https://dl.dropboxusercontent.com/u/15335397/misc/webgl-rmd

Rstudio pdf knit fails with “Environment Shaded undefined” error

大兔子大兔子 提交于 2019-12-01 21:24:28
When trying to knit a PDF using a template from package rticles output: rticles::acm_article I get the following error: ! LaTeX Error: Environment Shaded undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.76 \begin{Shaded} This appears to only happen when I include code chunks within the output document. Reproducible example : You will need to start a new R Markdown document using the New Document -> From Template -> Association for Computing Machinery . Here is the R Markdown file: --- title: Short Paper author: - name: I Am Me email:

Full size shiny app in an ioslides markdown presentation slide

六月ゝ 毕业季﹏ 提交于 2019-12-01 20:38:47
问题 Trying to figure out how to have a full size shiny app in an ioslides markdown. I have something almost working, but it is a bit ad-hoc. I am also not confident it will reproduce when I show the presentation on a larger resolution screen (as I use px in the div )?: --- title: "My Title" author: "My Name" date: "29 March 2016" runtime: shiny output: ioslides_presentation --- ## <div style="margin-left:-50px; margin-top:-50px; width:80%; height:100%"> ```{r, echo=FALSE, message=FALSE, fig.width