2014-07-24 15 views
7

sto correndo il seguente documento rmarkdown interattivo:Interactive documento rmarkdown che non visualizza correttamente dopo browser Refresh

### 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') 
    }) 
``` 

salvato minimal.Rmd, corro eseguendo

rmarkdown::run("minimal.Rmd") 

sulla R console. Dopo l'esecuzione di che, il documento viene visualizzato correttamente sul browser:

App displayed correctly

Dopo aggiornando il browser, il documento si presenta così:

App displayed incorrectly

(Ho provato questo su cromo e safari)

Ho notato che quando eseguo rmarkdown :: eseguito subito dopo aver salvato il file .Rmd ottengo l'output simile a knitr sulla console R e il documento viene visualizzato correttamente; quando si esegue rmarkdown :: eseguire senza salvare nuovamente il file non produce l'output simile a knitr sulla console e il documento viene visualizzato in modo errato. Questo potrebbe avere a che fare con rmarkdown :: eseguire la memorizzazione nella cache. L'uscita knitr simile che ottengo è:

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 

mie info sessione è:

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

Posso riprodurlo su Windows. Nessuna soluzione ancora. –

risposta

6

Aggiunta:

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

alla parte superiore del documento consente di risolvere il problema. Answered di Fereshteh Karimeddini sul gruppo Google di utenti brillanti.

Problemi correlati