Reputation: 11
A section of my R Shiny script is giving me a headache. In short, the script receives two data tables: data_tran and contam_datafile. data_tran is queried with contam_datafile for any matching IDs under the "Feature.ID" column. A user is then given the option to either keep the matching IDs, remove the matching IDs (by turning to zeros), or to do nothing.
data_tran_contam_filt_react = reactive({
if(input$contam_filter == "Remove"){
data_tran = data_tran_react()
contam_datafile = contam_datafile()
rownames(data_tran) = data_tran$Feature.ID
# data_tran = data_tran[ ! data_tran$Feature.ID %in% contam_datafile$Feature.ID,]
data_tran[contam_datafile$Feature.ID,!names(data_tran) %in% c("Consensus.Lineage","Feature.ID","ReprSequence","rowID")] = 0
rownames(data_tran) = 1:nrow(data_tran)
}
if(input$contam_filter == "Analyze"){
data_tran = data_tran_react()
contam_datafile = contam_datafile()
data_tran = data_tran[data_tran$Feature.ID %in% contam_datafile$Feature.ID,]
}
if(input$contam_filter == "No action"){
data_tran = data_tran_react()
}
})
This works when I run the R Shiny app locally within a combined ui/server script. I've tested it with several datasets and it's all good. However, when I transfer it to an Ubuntu LTS-based server, and select the option to "Remove", the app fails and provides the "Error in Summary.factor: ‘max’ not meaningful for factors" within the log files. All other aspects of the R Shiny script works locally and remotely except for the "Remove" function. I'll include the full error log below.
I don't get it. Any help would be appreciated.
Thanks
Warning in Ops.factor(i, 0L) : ‘>=’ not meaningful for factors
Warning: Error in Summary.factor: ‘max’ not meaningful for factors
86: stop
85: Summary.factor
84: [<-.data.frame
82: <reactive:data_tran_contam_filt_react> [DELETED]
66: data_tran_contam_filt_react
65: <reactive:data_long_react> [DELETED]
49: data_long_react
45: observe [DELETED]
44: <observer>
1: runApp
Warning: Error in Summary.factor: ‘max’ not meaningful for factors
107: <Anonymous>
106: stop
105: data_long_react
104: exprFunc [DELETED]
103: widgetFunc
102: ::
htmlwidgets
shinyRenderWidget
101: func
88: renderFunc
87: renderFunc
83: renderFunc
82: output$proc_main_alt
1: runApp
Warning: Error in Summary.factor: ‘max’ not meaningful for factors
107: <Anonymous>
106: stop
105: data_tran_contam_filt_react
104: exprFunc [DELETED]
103: widgetFunc
102: ::
htmlwidgets
shinyRenderWidget
101: func
88: renderFunc
87: renderFunc
83: renderFunc
82: output$proc_new_data
1: runApp
Execution halted
Ignore the "DELETED". It's just a server address and contains some identifying information.
Upvotes: 1
Views: 29
Reputation: 11
Thank you to Ric Villalba for the suggestion.
This turned out to be a simple R version issue, and likely caused by the change in stringsAsFactors between R 3.x and 4.x. It sent me down a whole 8-hour path of trying to update R and encountering package issues, but I have it all sorted out now.
Cheers
Upvotes: 0