- 例
- 問題陳述
- 解決方案搜索和
- 問題
...看到rmarkdown示例代碼。CSV嵌入在HTML中rmarkdown
欣賞通過修改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 ?
不幸的是這種解決方案並不在IE 11(Windows 8的)工作。該解決方案生成的鏈接不會觸發任何內容。它如何被修復? – user2030503
埃,使用真正的瀏覽器;-)看來,這是一個已知的問題與IE 11是腦死亡:http://caniuse.com/#feat=datauri;這意味着你不能爲IE 11嵌入這種類型的數據URI。它看起來像Edge也是大腦死亡。 – hrbrmstr
該解決方案適用於Chrome,但在Safari中,下載不會啓動,我們只能看到瀏覽器上顯示的csv。有沒有解決方法? –