2014-07-24 3 views
7

ich folgende interaktive rmarkdown Dokument renne:Interactive rmarkdown Dokument nicht korrekt nach Browser angezeigt aktualisieren

### Example of shiny app 

```{r, echo = FALSE, eval = TRUE} 
    numericInput("rows", "How many cars?", 5) 

renderTable({ 
    head(cars, input$rows) 
}) 
``` 

### Another example 

```{r, echo = FALSE} 
    sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30) 

    renderPlot({ 
    x <- faithful[, 2] # Old Faithful Geyser data 
    bins <- seq(min(x), max(x), length.out = input$bins + 1) 

    # draw the histogram with the specified number of bins 
    hist(x, breaks = bins, col = 'darkgray', border = 'white') 
    }) 
``` 

als minimal.Rmd gespeichert, ich es laufen durch

rmarkdown::run("minimal.Rmd") 

auf der R läuft Konsole. Nach dem Ausführen dass, zeigt das Dokument korrekt im Browser:

App displayed correctly

Nach Aktualisieren des Browsers, sieht das Dokument wie folgt aus:

App displayed incorrectly

(ich das auf Chrom versucht haben und Safari)

Ich habe festgestellt, dass wenn ich rmarkdown :: run sofort nach dem Speichern der .Rmd-Datei laufen lasse, bekomme ich knitr-ähnliche Ausgabe auf der R-Konsole, und das Dokument wird korrekt angezeigt; Wenn rmarkdown :: run ausgeführt wird, ohne die Datei erneut zu speichern, wird die knitr-ähnliche Ausgabe auf der Konsole nicht erzeugt, und das Dokument wird nicht korrekt angezeigt. Das könnte mit rmarkdown :: run caching stuff zu tun haben. Die knitr artige Ausgabe ich erhalte, ist:

Listening on http://127.0.0.1:6381 


processing file: minimal.Rmd 
    |................             | 25% 
    |................................         | 50% 
    |.................................................    | 75% 
    |.................................................................| 100% 
label: unnamed-chunk-2 (with options) 
List of 1 
$ echo: logi FALSE 


output file: /var/folders/15/q9z0km897fs93f_z1slpf09h0000gp/T//Rtmpt7kc98/minimal.knit.md 

/usr/local/bin/pandoc /var/folders/15/q9z0km897fs93f_z1slpf09h0000gp/T//Rtmpt7kc98/minimal.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /var/folders/15/q9z0km897fs93f_z1slpf09h0000gp/T/rmarkdown/rmd_b468d17c42847143a4499f693d7a0f45.html --smart --email-obfuscation none --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rmarkdown/rmd/h/default.html --variable theme:bootstrap --mathjax --variable mathjax-url:https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML --no-highlight --variable highlightjs=rmd_b468d17c42847143a4499f693d7a0f45_files/highlight 

Output created: /var/folders/15/q9z0km897fs93f_z1slpf09h0000gp/T/rmarkdown/rmd_b468d17c42847143a4499f693d7a0f45.html 
Warning in addResourcePath(prefix, dependency$src$file) : 
    Overriding existing prefix rmarkdown-performance-0.1 => /private/var/folders/15/q9z0km897fs93f_z1slpf09h0000gp/T/rmarkdown/rmd_54619711603ff951c709d43a6cda206b_files 

Meine Session info ist:

sessionInfo() 
R version 3.1.0 (2014-04-10) 
Platform: x86_64-apple-darwin13.1.0 (64-bit) 

locale: 
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] shiny_0.10.0  rmarkdown_0.2.46 

loaded via a namespace (and not attached): 
[1] bitops_1.0-6 caTools_1.17 digest_0.6.4 evaluate_0.5.5 formatR_0.10 htmltools_0.2.4 
[7] httpuv_1.3.0 knitr_1.6  Rcpp_0.11.2  RJSONIO_1.2-0.2 stringr_0.6.2 tools_3.1.0  
[13] xtable_1.7-3 
+0

Ich kann dies unter Windows reproduzieren. Noch keine Lösung. –

Antwort

6

Hinzufügen:

--- runtime: shiny output: html_document ---

auf den Anfang des Dokuments das Problem behebt. Answered von Fereshteh Karimeddini auf der Shiny Benutzer Google-Gruppe.

Verwandte Themen