Skip to content

Commit

Permalink
Merge pull request #25 from poissonconsulting/dev
Browse files Browse the repository at this point in the history
Add button to download an example dataset
  • Loading branch information
nehill197 authored Jun 5, 2024
2 parents f8c0346 + 87ed3fc commit 44d501f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/app-ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ app_ui <- function() {
footer = NULL,
header = dashboardHeader(
... = div(
h3("Ronald Lake Wood Bison Camera-Based Demographic Model"),
h3("Wood Bison Camera-Based Demographic Model"),
style = "vertical-align: baseline;"
)
),
Expand Down
21 changes: 20 additions & 1 deletion R/mod-upload.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ mod_upload_ui <- function(id, label = "upload") {
downloadButton(ns("download_template"), "Template"),
br(), br(),
tags$label("2. Upload data"),
uiOutput(ns("upload_bison"))
uiOutput(ns("upload_bison")),
br(), br(), br(), br(),
tags$label("Download example data set"), br(),
downloadButton(ns("download_example"), "Example Data")
)

fluidRow(
Expand Down Expand Up @@ -76,6 +79,22 @@ mod_upload_server <- function(id) {
}
)

# read in example data
path2 <- system.file(
package = "bisonpictools",
"example-data/data-raw.xlsx"
)
sheets2 <- readxl::excel_sheets(path2)
example_data <- lapply(sheets2, function(x) readxl::read_excel(path2, x))
names(example_data) <- sheets2

output$download_example <- downloadHandler(
filename = "wood-bison-example-data.xlsx",
content = function(file) {
writexl::write_xlsx(example_data, file)
}
)

# upload data widget
output$upload_bison <- renderUI({
rv$reset
Expand Down
2 changes: 1 addition & 1 deletion inst/helpfiles/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.

**Workflow**

1. Download template, fill in data and upload file.
1. Download template, fill in data, and upload file.
2. Run model.
3. Explore the results.

Expand Down
2 changes: 2 additions & 0 deletions inst/helpfiles/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The uploaded data will be run through a series of checks before it will be accep
- Correct the error.
- Upload the corrected data.
- Repeat until the file is successfully uploaded.

If desired, download an example dataset by clicking the **Download Example Data** button, then proceed with step 2 above to explore the app's functionality.

##### Required Data Format

Expand Down

0 comments on commit 44d501f

Please sign in to comment.