Seeing inconsistent results with dataTableOutput (https://github.com/rstudio/DT). When I start shiny from an R console, the first time I run the app the height argument in dataTableOutput() causes the app to crash. If I then CTRL-C to stop shiny, then shiny::runApp(), then the app thenceforth works as expected. Not passing the height is okay locally. The box is filled in and sizes its height automatically. However, when loading the app on shinyapps.io, the box is always empty and has a small height (let's say 60px). No matter what I do on shinyapps.io, if the the height is, e.g., height=300, then the app will always crash. No CTRL-C will work on shinyapps.io. Sometimes the app will refuse to start locally when "height=300" is present, but if I comment out dataTableOutput completely, re-run shiny::runApp(), then bring dataTableOutput back without restarting shiny, then the app loads okay.
The error:
Warning: Error in dataTableOutput: unused argument (height = "200")
100: h
99: .handleSimpleError
98: dots_list
97: div
96: dots_list
95: div
94: dots_list
93: div
92: box
91: dots_list
90: div
89: fluidRow
88: dots_list
87: div
86: column
85: dots_list
84: div
83: fluidRow
82: dots_list
81: div
80: tabItem
79: lapply
78: tabItems
77: dots_list
76: tags$section
75: dots_list
74: div
73: dashboardBody
72: tagAssert
71: dashboardPage
70: ..stacktraceon..
69: eval
68: eval
67: sourceUTF8
66: func
65: uiHandlerSource
64: handler
63: handler
62: handler
61: handlers$invoke
60: withCallingHandlers
59: domain$wrapSync
58: promises::with_promise_domain
57: captureStackTraces
56: withCallingHandlers
55: withLogErrors
54: withCallingHandlers
53: force
52: withVisible
51: withCallingHandlers
50: domain$wrapSync
49: promises::with_promise_domain
48: captureStackTraces
47: doTryCatch
46: tryCatchOne
45: tryCatchList
44: tryCatch
43: do
42: hybrid_chain
41: force
40: withVisible
39: withCallingHandlers
38: domain$wrapSync
37: promises::with_promise_domain
36: captureStackTraces
35: doTryCatch
34: tryCatchOne
33: tryCatchList
32: tryCatch
31: do
30: hybrid_chain
29: handler
28: func
27: compute
26: doTryCatch
25: tryCatchOne
24: tryCatchList
23: tryCatch
22: rookCall
21: <Anonymous>
20: evalq
19: evalq
18: doTryCatch
17: tryCatchOne
16: tryCatchList
15: doTryCatch
14: tryCatchOne
13: tryCatchList
12: tryCatch
11: execCallbacks
10: run_now
9: service
8: serviceApp
7: ..stacktracefloor..
6: withCallingHandlers
5: domain$wrapSync
4: promises::with_promise_domain
3: captureStackTraces
2: ..stacktraceoff..
1: shiny::runApp
The code (two example boxes although one is enough to show the issue):
dashboardPage(
dashboardHeader(title = 'Energy comparison'),
dashboardSidebar(
sidebarMenu(
...
menuItem('Stacked', tabName = 'table', icon = NULL)
)
),
dashboardBody(
tabItems(
...
tabItem(
tabName = 'table',
fluidRow(
column(6,
fluidRow(
box(title = 'Annual energy by source',
solidHeader = TRUE, status = 'primary', width = 12,
dataTableOutput('tab1') # Always works locally.
# Doesn't crash shinyapps.io
# but always show a tiny box
# with no data.
)
)
),
column(6,
fluidRow(
box(title = 'Annual energy by source %',
solidHeader = TRUE, status = 'primary', width = 12,
dataTableOutput('tab2', height="auto")
# height = "auto" or "300"
# Causes error sporadically locally.
# Can get it working locally by removing "height=..."
# then reloading the page while shiny is running.
# But this always crashes on shinyapps.io.
)
)
)
)
)
)
)
)
TAG: dataTableOutput
There are two functions of dataTableOutput, one which is present in shiny package which does not have height argument and another in DT package. I don't know if you are loading the DT package at all but it is better to mention explicitly that you want to use dataTableOutput from DT package.
DT::dataTableOutput('tab2', height="auto")
Related
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.
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
I am using Slime (Emacs) and Common Lisp (SBCL). After evaluating an expression, the REPL returns a list of CL objects:
(#<BOOKMARK-ENTRY {1009AFB963}> #<BOOKMARK-ENTRY {1009AFD5A3}>
#<BOOKMARK-ENTRY {1009AFDB53}> #<BOOKMARK-ENTRY {1009AFE0E3}>
#<BOOKMARK-ENTRY {1009AFE683}> #<BOOKMARK-ENTRY {1009AFEC23}>
#<BOOKMARK-ENTRY {1009AFF173}> #<BOOKMARK-ENTRY {1009AFF753}>
#<BOOKMARK-ENTRY {1009AFFCD3}> #<BOOKMARK-ENTRY {1009B00233}>
#<BOOKMARK-ENTRY {1009B00783}> #<BOOKMARK-ENTRY {1009B00CE3}>
#<BOOKMARK-ENTRY {1009B01253}> #<BOOKMARK-ENTRY {1009B01823}>
#<BOOKMARK-ENTRY {1009B01DD3}> #<BOOKMARK-ENTRY {1009B02393}>
#<BOOKMARK-ENTRY {1009B028B3}> #<BOOKMARK-ENTRY {1009B02E13}>
#<BOOKMARK-ENTRY {1009B03373}> #<BOOKMARK-ENTRY {1009B03903}>
#<BOOKMARK-ENTRY {1009B03EB3}> #<BOOKMARK-ENTRY {1009B04453}>
#<BOOKMARK-ENTRY {1009B049F3}> #<BOOKMARK-ENTRY {1009B04F23}>
#<BOOKMARK-ENTRY {1009B054A3}> #<BOOKMARK-ENTRY {1009B05AB3}>
#<BOOKMARK-ENTRY {1009B05FF3}> #<BOOKMARK-ENTRY {1009B06513}>
#<BOOKMARK-ENTRY {1009B06A83}> #<BOOKMARK-ENTRY {1009B07133}>
#<BOOKMARK-ENTRY {1009B076B3}> #<BOOKMARK-ENTRY {1009B07C13}>
#<BOOKMARK-ENTRY {1009B08213}>)
If I click to inspect the list, a new window is opened with all objects listed:
#<CONS {1009AFCBB7}>
--------------------
A proper list:
0: #<BOOKMARK-ENTRY {1009AFB963}>
1: #<BOOKMARK-ENTRY {1009AFD5A3}>
2: #<BOOKMARK-ENTRY {1009AFDB53}>
3: #<BOOKMARK-ENTRY {1009AFE0E3}>
4: #<BOOKMARK-ENTRY {1009AFE683}>
5: #<BOOKMARK-ENTRY {1009AFEC23}>
6: #<BOOKMARK-ENTRY {1009AFF173}>
7: #<BOOKMARK-ENTRY {1009AFF753}>
8: #<BOOKMARK-ENTRY {1009AFFCD3}>
9: #<BOOKMARK-ENTRY {1009B00233}>
10: #<BOOKMARK-ENTRY {1009B00783}>
11: #<BOOKMARK-ENTRY {1009B00CE3}>
12: #<BOOKMARK-ENTRY {1009B01253}>
13: #<BOOKMARK-ENTRY {1009B01823}>
14: #<BOOKMARK-ENTRY {1009B01DD3}>
15: #<BOOKMARK-ENTRY {1009B02393}>
16: #<BOOKMARK-ENTRY {1009B028B3}>
17: #<BOOKMARK-ENTRY {1009B02E13}>
18: #<BOOKMARK-ENTRY {1009B03373}>
19: #<BOOKMARK-ENTRY {1009B03903}>
20: #<BOOKMARK-ENTRY {1009B03EB3}>
21: #<BOOKMARK-ENTRY {1009B04453}>
22: #<BOOKMARK-ENTRY {1009B049F3}>
23: #<BOOKMARK-ENTRY {1009B04F23}>
24: #<BOOKMARK-ENTRY {1009B054A3}>
25: #<BOOKMARK-ENTRY {1009B05AB3}>
26: #<BOOKMARK-ENTRY {1009B05FF3}>
27: #<BOOKMARK-ENTRY {1009B06513}>
28: #<BOOKMARK-ENTRY {1009B06A83}>
29: #<BOOKMARK-ENTRY {1009B07133}>
30: #<BOOKMARK-ENTRY {1009B076B3}>
31: #<BOOKMARK-ENTRY {1009B07C13}>
32: #<BOOKMARK-ENTRY {1009B08213}>
If I click on any object (bookmark entry), I am going to see the info I want with the slot values, such as:
#<BOOKMARK-ENTRY {1009B01253}>
--------------------
Class: #<STANDARD-CLASS NYXT:BOOKMARK-ENTRY>
--------------------
Group slots by inheritance [ ]
Sort slots alphabetically [X]
All Slots:
[ ] ANNOTATION = ""
[ ] DATE = #2021-07-21T19:13:02.981953-03:00
[ ] SEARCH-URL = ""
[ ] SHORTCUT = ""
[ ] TAGS = ("certo" "deu" "tudo" "white" "yankee")
[ ] TITLE = ""
[ ] URL = #<QURI.URI.HTTP:URI-HTTPS https://en.wikipedia.org/wiki/Yankee_White>
[set value] [make unbound]
OK. But how do I leave this information and get back to the previous information?
I mean the screen with:
```lisp
#<CONS {1009AFCBB7}>
--------------------
A proper list:
0: #<BOOKMARK-ENTRY {1009AFB963}>
.
.
.
32: #<BOOKMARK-ENTRY {1009B08213}>
?
Is there a command for this? What is the name?
Is there a keybinding to do it?
Thanks.
After using C-h m, I managed to find the command slime-inspector-pop which is bounded to l in this buffer.
To illustrate, let's visit the object numbered #26:
26: #<BOOKMARK-ENTRY {100B847933}>
I press return on it and I get:
#<BOOKMARK-ENTRY {100B847933}>
--------------------
Class: #<STANDARD-CLASS NYXT:BOOKMARK-ENTRY>
--------------------
Group slots by inheritance [ ]
Sort slots alphabetically [X]
All Slots:
[ ] ANNOTATION = ""
[ ] DATE = #2021-07-03T10:42:53.050403-03:00
[ ] SEARCH-URL = ""
[ ] SHORTCUT = ""
[ ] TAGS = ("CNN")
[ ] TITLE = ""
[ ] URL = #<QURI.URI.HTTP:URI-HTTPS https://www.cnnbrasil.com.br/>
[set value] [make unbound]
To get back, I just do l. Thus, I am back to the previous window with a subtle difference. Now, the name of the object is slightly different in the list with #13:
26: #13=#<BOOKMARK-ENTRY {100B847933}>
If my interpretation is not wrong, this shows that the object was inspected and that it was 13rd object in the list to be visited.
I have to build a Shiny-Board, there I need to get more then 10k rows from the Google Analytics Reporting API. For this I use my own Google API-Project
Doing this in RStudio works perfectly and I can get as much rows I want. If I do this in shiny I don´t get a problem getting less then 10k rows if I want to get more I get the following Error:
2017-08-17 14:12:55> Fetched: landingPagePath city date sourceMedium sessions newUsers bounceRate pageviewsPerSession avgSessionDuration transactions transactionRevenue. [10000] total results out of a possible [190119], Start-Index: 1
2017-08-17 14:12:55> Batching data into [20] calls.
Request #: 1 : 10001 : 20001 : 30001 : 40001 : 50001 : 60001 : 70001 : 80001 : 90001
2017-08-17 14:12:57> Request to profileId: ()
Warning: Error in f: Invalid dimension or metric:
Stack trace (innermost first):
114: f
113: FUN
112: lapply
111: googleAuthR::gar_batch
110: FUN
109: lapply
108: googleAuthR::gar_batch_walk
107: batchData
106: loop_ids
105: f
104: with_shiny
103: eventReactiveHandler [#405]
83: gadata
82: renderDataTable [#511]
81: func
80: origRenderFunc
79: output$Con_Table
4: <Anonymous>
3: do.call
2: print.shiny.appobj
1: <Promise>
I can call the same query in a differnt Timeframe (to don´t hit the 10k Limit) and it works with the dimensions and metrics.
Here is the query I use:
Auth
options("googleAuthR.webapp.client_id" = app_config$gaClientId)
options("googleAuthR.webapp.client_secret" = app_config$gaClientSecret)
options("googleAuthR.scopes.selected" =c("https://www.googleapis.com/auth/analytics.readonly"))
## Get auth code from return URL
token <- callModule(googleAuth, "login")
ga_accounts <- reactive({
req(token())
with_shiny(ga_account_list, shiny_access_token = token())
})
selected_id <- callModule(authDropdown, "auth_menu", ga.table = ga_accounts)
Query Data
ga<-with_shiny(google_analytics,
id = gaid,
start=(as.character(input$datestart)), end=(as.character(input$dateend)),
metrics = metric,
dimensions = dime,max=99999999,
shiny_access_token = token())
Some more information:
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
> packageVersion("googleAnalyticsR")
[1] ‘0.4.1’
Does anybody has a idea what I´m missing?
Thanks to Mark Edmondson the problem is solved. Instead of using the V3 Version of the API just use the V4 Version. The call looks like this then:
ga<-with_shiny(google_analytics_4,
id = gaid,
date_range = c(as.character(input$datestart), as.character(input$dateend)),
metrics = metric,
dimensions = dime,anti_sample = TRUE,
shiny_access_token = token())
I'm using SQLite on Windows UWP (10).
This is what I am doing:
Open connection
Begin Transaction
Update row
Commit Transaction
Close connection
And yet, the value in the database is not actually written to the table. When I reload the record (after disconnecting and reconnecting, or not disconnecting) the value remains from before I called the update.
Is there something extra I need to do? In DB Browser for SQLite, there is a menu item called "Write Changes". What does that do? Just a normal commit? In the browser, the changes are only committed if I click on this menu item.
Also, I put a trace on the connection, and this is what came up:
Executing: begin transaction
Executing: UPDATE
'TaskManagement.TaskInfo'
SET
StatusKey = #StatusKey, ProbAddDttm = #ProbAddDttm, ProbCode = #ProbCode, ProbPriority = #ProbPriority, ProbGroup = #ProbGroup, ProbInsp = #ProbInsp, Activity = #Activity, UpdateDttm = #UpdateDttm, Asset = #Asset, Address = #Address, TaskStartDttm = #TaskStartDttm, MaintenanceScheduleSetup = #MaintenanceScheduleSetup, MaintenanceScheduleBatch = #MaintenanceScheduleBatch, ProbZone = #ProbZone, ProbContractor = #ProbContractor, ProbNotes = #ProbNotes, JobCompleted = #JobCompleted, Resolution = #Resolution, Result = #Result, ActType = #ActType, Complaint = #Complaint, BudgetNo = #BudgetNo, Contractor = #Contractor, MapLocCorrect = #MapLocCorrect, FollowUpWorkRequired = #FollowUpWorkRequired, Condition = #Condition, ActPriority = #ActPriority, ExpectedVersion = #ExpectedVersion, EmailProbOriginator = #EmailProbOriginator, IsBug = #IsBug, IsCompletePendingCheckIn = #IsCompletePendingCheckIn
WHERE
TaskInfoKey = #PrimaryKey
0: 63711ec4-57d0-4a23-8595-0022b757af44
1: 6
2: 2013-06-03 08:56:39:117
3: 13
4: 2
5: 17
6: 24
7:
8: 2015-11-10 04:05:09:502
9:
10:
11: 2013-06-03 08:56:39:117
12:
13:
14:
15:
16: Test this mofo!
17: 2013-08-15 12:13:24:620
18:
19:
20:
21:
22:
23: 4
24: False
25: False
26:
27:
28: 3
29: False
30: False
31: False
Executing: Commit
So, in the end, the problem was that I was not passing the parameters in to the library correctly. The connection's CreateCommand method only allows you to pass in the command text, and an array of objects. This is incorrect because that means you can't name the parameters. So, I consider this a piece of missing functionality in this particular implementation of SQLite for UWP.
Secondly, this should have errored! None of the parameter names I mentioned above were passed in to the command, and yet when I ran it, no exception was thrown. So, I consider this to be the second bug in the implementation.
I fixed it like this:
var command = _Connection.CreateCommand(commandText, new object[0]);
if (parameters != null)
{
foreach (var parameter in parameters)
{
if (parameter.ParameterValue is DateTime)
{
parameter.ParameterValue = ((DateTime)parameter.ParameterValue).ToString("yyyy-MM-dd hh:mm:ss:fff");
}
command.Bind(parameter.ParameterName, parameter.ParameterValue);
}
}
return command;
I'm working on a quite complicated dashboard written in R using Shiny and ggplot2.
At the moment it was written everything worked fine, but after some time (data is updated daily) it started to segfault while rendering specific pages.
I can reproduce the problem by opening specific tab with 12 ggplot graphs.
Console output at the moment of failure looks like this:
dashboard_1 | address 0x194b1, cause 'memory not mapped'
dashboard_1 |
dashboard_1 | Traceback:
dashboard_1 | 1: mapply(FUN = f, ..., SIMPLIFY = FALSE)
dashboard_1 | 2: Map(build_grob, plot$layer, data)
dashboard_1 | 3: ggplot_gtable(data)
dashboard_1 | 4: print.ggplot(result$value)
dashboard_1 | 5: print(result$value)
dashboard_1 | 6: eval(expr, envir, enclos)
dashboard_1 | 7: eval(expr, pf)
dashboard_1 | 8: withVisible(eval(expr, pf))
dashboard_1 | 9: evalVis(expr)
dashboard_1 | 10: capture.output(print(result$value))
...
dashboard_1 | 65: tryCatchOne(expr, names, parentenv, handlers[[1L]])
dashboard_1 | 66: tryCatchList(expr, classes, parentenv, handlers)
dashboard_1 | 67: tryCatch(evalq((function (handle, binary, message) { for (handler in .wsconns[[as.character(handle)]]$.messageCallbacks) { result <- try(handler(binary, message)) if (inherits(result, "try-error")) { .wsconns[[as.character(handle)]]$close() return() } }})("62978544", FALSE, "{\"method\":\"update\",\"data\":{\"daterange:shiny.date\":[\"2014-04-26\",\"2015-04-26\"],\"group_by\":\"weeks\"}}"), <environment>), error = .rcpp_error_recorder)
dashboard_1 | 68: withCallingHandlers(tryCatch(evalq((function (handle, binary, message) { for (handler in .wsconns[[as.character(handle)]]$.messageCallbacks) { result <- try(handler(binary, message)) if (inherits(result, "try-error")) { .wsconns[[as.character(handle)]]$close() return() } }})("62978544", FALSE, "{\"method\":\"update\",\"data\":{\"daterange:shiny.date\":[\"2014-04-26\",\"2015-04-26\"],\"group_by\":\"weeks\"}}"), <environment>), error = .rcpp_error_recorder), warning = .rcpp_warning_recorder)
dashboard_1 | aborting ...
dashboard_1 | Segmentation fault
rmreports_dashboard_1 exited with code 139
I would like to trace the root cause and introduce changes to prevent segfault from happening. What is the best way to approach this problem?
I was searching your problem was able to find this thread. https://github.com/hadley/dplyr/issues/322
Which says to try to update 'dplyr' with 'devtools'.
"devtools::install_github("hadley/dplyr", build_vignettes = FALSE)"