Download data underlying plotly graph in R

我的梦境 提交于 2021-01-29 11:16:28

问题


I am using plotly in Rmarkdown. When I plot a graph, id there a way to download the underlying data ?

library(plotly)
x <- c(1:100)
random_y <- rnorm(100, mean = 0)
data <- data.frame(x, random_y)
p <- plot_ly(data, x = ~x, y = ~random_y, type = 'scatter', mode = 'lines')

Typically in the plot above I would like to get the data data.frame in some csv format


回答1:


You can embed the CSV file into your Rmarkdown HTML using this function: yihui.name/en/2018/07/embed-file.



来源:https://stackoverflow.com/questions/57460791/download-data-underlying-plotly-graph-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!