简体   繁体   中英

Can't Read Data from CSV file to R Markdown Shiny Document

I am experimenting with the R Markdown Shiny documents for interactive reporting. First trouble got is to read data from local csv file.

{r, cache=TRUE} raw1<-read.csv("data/set1.csv") splits <- unique(raw1$split) The error message I have is " Error in file(file, "rt") : cannot open the connection".

There is no issue to use the above code to read data in regular R Markdown documents. Can anyone help the best practice to create interactive reporting using Shiny Document?

Try changing cache to FALSE. I haven't been able to successfully use caching when hosting on a Shiny server.

```{r, echo = FALSE, message=FALSE}
library(data.table)
dataset <- fread("yourfile.csv",header=T)
```

Try fread from data.table. It should help. Worked well for me. It's also way faster than read.csv.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM