- Ví dụ
- Vấn đề tuyên bố
- Giải pháp tìm kiếm và
- Câu hỏi
... xem mã ví dụ rmarkdown.Nhúng csv trong html rmarkdown
Đánh giá cao câu trả lời thể hiện giải pháp bằng cách sửa đổi đoạn mã rmarkdown.
---
title: "Reproducable Example"
author: "user2030503"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Example: mtcars
```{r}
write.csv2(mtcars, "./file.csv")
# Code to embed mtcars as csv
# Code to provide mechanism for button or link for later user interaction to open/save the csv.
```
## Problem
* I want to embed the csv file into the html generated by this rmarkdown script.
* Embedding here means, that the csv data are integral part of the hmtl (i.e. for offline use).
* I want a mechanism (button or link) in the html, which allows the user to open/save the data the csv.
## Search for a solution
There are techniques for embedding rdata files.
* http://rmarkdown.rstudio.com/articles_rdata.html
* https://github.com/richarddmorey/BayesFactorExtras/blob/master/BayesFactorExtras/R/downloadURI.R
## Question
* Dispite of above approaches, I did not find a solution yet how to solve the problem.
* How can it be achieved demonstrating it via this reproducable example ?
Thật không may giải pháp này không hoạt động trong IE 11 (Windows 8). Liên kết được tạo ra bởi giải pháp không kích hoạt bất cứ điều gì. Làm thế nào nó có thể được cố định ? – user2030503
Aye, sử dụng một trình duyệt thực sự ;-) Có vẻ như đây là một vấn đề đã biết với IE 11 là não chết: http://caniuse.com/#feat=datauri; điều đó có nghĩa là bạn không thể nhúng loại URI dữ liệu này cho IE 11. Có vẻ như Edge cũng đã chết não. – hrbrmstr
Giải pháp này rất tuyệt vời cho Chrome nhưng trong Safari, việc tải xuống không được bắt đầu và chúng tôi chỉ thấy csv được hiển thị trên trình duyệt. Có cách giải quyết nào không? –