问题
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