Shiny app zip files with no folder name
Is your feature request related to a problem? Please describe. Zip files from Shiny app include "data" folder. Users confused that the files are part of the "data" process.
Describe the solution you'd like Removed the "data" folder from the zip files generated by the Shiny app.
Describe alternatives you've considered Using other folder name too messy for the Shiny app.
Additional context Possibly use zip::zip() instead of utils::zip()
Solution is not zip::zip() but to use "extras = "-j"" to strip the path.
https://stackoverflow.com/questions/50339737/cannot-zip-directory-from-within-r-without-including-full-file-path
Five ways to get a zip file so have to ensure each has the modified code.
- [x] QC
- [x] Aggregate
- [x] SummaryStats
- [x] Hobo
- [x] Gage
Works in console but when run in Shiny it fails to create the zip file.

put on hold
https://stackoverflow.com/questions/51770621/zip-files-without-directory-name-in-r
Tested "-j" and it worked.
# Examples of each operation
# 00. Set up
# Parameters
Selection.Operation <- c("GetGageData"
, "QCRaw"
, "Aggregate"
, "SummaryStats")
Selection.Type <- c("Air","Water","AW","Gage","AWG","AG","WG")
Selection.SUB <- c("Data0_Original"
, "Data1_RAW"
, "Data2_QC"
, "Data3_Aggregated"
, "Data4_Stats")
(myDir.BASE <- tempdir()) # create and print temp directory for example data
# Create data directories
myDir.create <- file.path(myDir.BASE, Selection.SUB[1])
ifelse(dir.exists(myDir.create) == FALSE
, dir.create(myDir.create)
, "Directory already exists")
myDir.create <- file.path(myDir.BASE, Selection.SUB[2])
ifelse(dir.exists(myDir.create) == FALSE
, dir.create(myDir.create)
, "Directory already exists")
myDir.create <- file.path(myDir.BASE, Selection.SUB[3])
ifelse(dir.exists(myDir.create) == FALSE
, dir.create(myDir.create)
, "Directory already exists")
myDir.create <- file.path(myDir.BASE, Selection.SUB[4])
ifelse(dir.exists(myDir.create) == FALSE
, dir.create(myDir.create)
, "Directory already exists")
myDir.create <- file.path(myDir.BASE, Selection.SUB[5])
ifelse(dir.exists(myDir.create) == FALSE
, dir.create(myDir.create)
, "Directory already exists")
# Save example data (assumes myDir.BASE directory exists)
myData <- data_raw_test2_AW_20130426_20130725
write.csv(myData, file.path(myDir.BASE
, Selection.SUB[2]
, "test2_AW_20130426_20130725.csv"))
myData <- data_raw_test2_AW_20130725_20131015
write.csv(myData, file.path(myDir.BASE
, Selection.SUB[2]
, "test2_AW_20130725_20131015.csv"))
myData <- data_raw_test2_AW_20140901_20140930
write.csv(myData, file.path(myDir.BASE
, Selection.SUB[2]
, "test2_AW_20140901_20140930.csv"))
myData <- data_raw_test4_AW_20160418_20160726
write.csv(myData, file.path(myDir.BASE
, Selection.SUB[2]
, "test4_AW_20160418_20160726.csv"))
myFile <- "config.TZ.Central.R"
file.copy(file.path(path.package("ContDataQC"), "extdata", myFile)
, file.path(myDir.BASE, Selection.SUB[2], myFile))
# zip file
setwd(tempdir())
zip("test_nodir.zip", list.files("Data1_RAW", pattern = "*.csv", full.names = TRUE), "-j")

Did not work in practice.
Had added full.names as a parameter. It was causing issues. Removed it.