Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create csv plot download #18

Open
okanji opened this issue Mar 23, 2021 · 0 comments
Open

Create csv plot download #18

okanji opened this issue Mar 23, 2021 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@okanji
Copy link
Contributor

okanji commented Mar 23, 2021

The UI for a download csv button has been created. Now the functionality to get the data that the plot is showing needs to be built into a function. The current code downloads a mock csv file.

  1. The UI for the download csv button is here:

    cmip6-BC/app.R

    Lines 143 to 144 in 275efda

    # ~~~ Download csv data button
    # downloadButton(outputId = "downloadData", label = "Download data"),

  2. The body of this function needs to be edited to return the actual plot data as a data frame. Currently it returns a mock data frame:

    cmip6-BC/app.R

    Lines 333 to 339 in 275efda

    # ~~~ Function to return plot data, using mock data currently
    # getPlotData <- function() {
    #
    # # TODO: Need to return actual plot data
    # return(data.frame(A=1:10, B=2:11)) # Mock Data
    # }

  3. The download handler that calls the function above and converts the data frame to a downloadable csv is here:

    cmip6-BC/app.R

    Lines 629 to 637 in 275efda

    # ~~~ Download csv data handler
    # output$downloadData <- downloadHandler(
    # filename = "Data.csv",
    #
    # content = function(file) {
    # write.csv(getPlotData(), file)
    # }
    # )

All of the above needs to be uncommented. Only 3. needs to be edited.

@okanji okanji added the help wanted Extra attention is needed label Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant