Dygraph in knitr does not work

When trying to knit my digraph in R using Knitr:

library(dygraphs) dygraph(nhtemp, main = "New Haven Temperatures") %>% dyRangeSelector(dateWindow = c("1920-01-01", "1960-01-01")) 

I get the following error:

 ## Error in validateCssUnit(sizeInfo$width): "\maxwidth" is not a valid CSS unit (eg, "100%", "400px", "auto") 

Can anyone help with how I can fix this or what does it mean?

EDIT: sample code.

 \documentclass{article} \begin{document} <<include=FALSE>>= library(knitr) options(width=55, formatR.arrow=TRUE, highlight=TRUE, scipen=1, digits=3, tidy=TRUE, comment='##') opts_chunk$set(fig.width=4, fig.height=4, fig.align='center', tidy=TRUE, highlight=TRUE, cache=TRUE, dev='tikz', fig.path='figure/', cache.path='cache/') @ <<include=FALSE>>= library(tikzDevice) @ <<>>= library(dygraphs) dygraph(nhtemp, main = "New Haven Temperatures") @ \end{document} 
+3
source share
1 answer

Update : starting with knitr 1.13 (not yet released), HTML widgets are automatically converted to screenshots using a web page when the output format is not HTML.


dygraphs is an htmlwidgets -based R package ( http://htmlwidgets.org ) which means that it works only for HTML output (for example, from R Markdown documents or Brilliant applications). LaTeX documents cannot use any htmlwidgets packages.

0
source

Source: https://habr.com/ru/post/1243475/


All Articles