Closed AshleyWoods closed 6 years ago
Thanks for reporting this I’m on the road I’ll try to get back by Friday
On Jun 6, 2018, at 12:31 PM, AshleyWoods notifications@github.com wrote:
There is currently an error when attempting to download the table as a .csv file. The code in the UI looks like this: downloadButton('downloadData', label = "Download Table"), And the code in the server looks like this: `downloadInfo <- function(){ gDat <- gbif_data() if(input$tableCols == 1){ return(gDat[,c(input$tableDef)]) } else if(input$tableCols == 2){ return(gDat) } else{ return(gDat[,c(input$tableCus)]) } }
output$downloadData <- downloadHandler( filename = function(){"gbifDat.csv"}, content = function(file){ write.csv(downloadInfo(), file) } )`
gbif_data() is the method that originally retrieves the data for both the map tab and the table tab, so it should be giving this tab the same values. The Input$tableCols/Def/Cus are inputs that determine which columns appear in the downloadable table. The error I am getting looks like this:
Warning: Error in : Columns 43, 47, 48, 60, 65, 69, 75, 76, 106, 121, 133, 134, 135, 175, 183, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 207, 219, 229, 230 not found Stack trace (innermost first): 66: 65: stop 64: abort 63: stopc 62: check_names_before_after.character 61: check_names_df.character 60: check_names_df 59: [.tbl_df 58: [ [/home/woodsae/soar/R/soar-Dashboard.R#278] 57: downloadInfo [/home/woodsae/soar/R/soar-Dashboard.R#278] 56: is.data.frame 55: write.table 54: eval 53: eval 52: eval.parent 51: write.csv 50: download$func [/home/woodsae/soar/R/soar-Dashboard.R#291] 1: runApp Error : Columns 43, 47, 48, 60, 65, 69, 75, 76, 106, 121, 133, 134, 135, 175, 183, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 207, 219, 229, 230 not found
Any idea what the problem may be?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
This turned out to be a simple mistake to make. The column ids were being treated as characters instead of numeric so I just converting them to class numeric
. Also note that the function c
was not necessary because input$tableDef
was already a vector of numbers. I patched this bug in 9fc3d587 so just go ahead and pull the master branch to get my update.
I guess as a follow up note that when a bug seems perplexing in R it is often times because the class
of the object is not what the function was expecting.
Oh and as a follow up follow up ;) The app looks really nice! Great job implementing all the ideas we discussed!
There is currently an error when attempting to download the table as a .csv file. The code in the UI looks like this:
downloadButton('downloadData', label = "Download Table"),
And the code in the server looks like this:gbif_data() is the method that originally retrieves the data for both the map tab and the table tab, so it should be giving this tab the same values. The Input$tableCols/Def/Cus are inputs that determine which columns appear in the downloadable table. The error I am getting looks like this:
Warning: Error in : Columns
65: stop
64: abort
63: stopc
62: check_names_before_after.character
61: check_names_df.character
60: check_names_df
59: [.tbl_df
58: [ [/home/woodsae/soar/R/soar-Dashboard.R#278]
57: downloadInfo [/home/woodsae/soar/R/soar-Dashboard.R#278]
56: is.data.frame
55: write.table
54: eval
53: eval
52: eval.parent
51: write.csv
50: download$func [/home/woodsae/soar/R/soar-Dashboard.R#291]
1: runApp
Error : Columns
43
,47
,48
,60
,65
,69
,75
,76
,106
,121
,133
,134
,135
,175
,183
,191
,192
,193
,194
,195
,196
,197
,198
,199
,200
,207
,219
,229
,230
not found Stack trace (innermost first): 66:43
,47
,48
,60
,65
,69
,75
,76
,106
,121
,133
,134
,135
,175
,183
,191
,192
,193
,194
,195
,196
,197
,198
,199
,200
,207
,219
,229
,230
not foundAny idea what the problem may be? #