@@ -1339,20 +1339,7 @@ srv_distribution <- function(id,
13391339 expr = quote(test_table )
13401340 )
13411341
1342- decorated_output_q <- reactive({
1343- tab <- req(input $ tabs ) # tab is NULL upon app launch, hence will crash without this statement
1344- test_q_out <- try(test_q(), silent = TRUE )
1345- test_q_out <- output_test_q()
1346-
1347- out_q <- switch (tab ,
1348- Histogram = decorated_output_dist_q(),
1349- QQplot = decorated_output_qq_q()
1350- )
1351- c(out_q , output_summary_q(), test_q_out )
1352- })
1353-
13541342 dist_r <- reactive(req(decorated_output_dist_q())[[" histogram_plot" ]])
1355-
13561343 qq_r <- reactive(req(decorated_output_qq_q())[[" qq_plot" ]])
13571344
13581345 summary_r <- reactive({
@@ -1398,29 +1385,52 @@ srv_distribution <- function(id,
13981385 brushing = FALSE
13991386 )
14001387
1401- output $ t_stats <- DT :: renderDataTable(tests_r()[[" html" ]])
1388+ decorated_output_dist_dims_q <- reactive({
1389+ dims <- req(pws1 $ dim())
1390+ q <- req(decorated_output_dist_q())
1391+ teal.reporter :: teal_card(q ) <- modify_last_chunk_outputs_attributes(
1392+ teal.reporter :: teal_card(q ), list (dev.width = dims [[1 ]], dev.height = dims [[2 ]])
1393+ )
1394+ q
1395+ })
14021396
1403- # Render R code.
1404- source_code_r <- reactive(teal.code :: get_code(req(decorated_output_q())))
1397+ decorated_output_qq_dims_q <- reactive({
1398+ dims <- req(pws2 $ dim())
1399+ q <- req(decorated_output_qq_q())
1400+ teal.reporter :: teal_card(q ) <- modify_last_chunk_outputs_attributes(
1401+ teal.reporter :: teal_card(q ), list (dev.width = dims [[1 ]], dev.height = dims [[2 ]])
1402+ )
1403+ q
1404+ })
14051405
1406- teal.widgets :: verbatim_popup_srv(
1407- id = " rcode" ,
1408- verbatim_content = source_code_r ,
1409- title = " R Code for distribution"
1410- )
1411- reactive(
1406+ decorated_output_q <- reactive({
1407+ tab <- req(input $ tabs ) # tab is NULL upon app launch, hence will crash without this statement
1408+ test_q_out <- output_test_q()
1409+
1410+ out_q <- switch (tab ,
1411+ Histogram = decorated_output_dist_dims_q(),
1412+ QQplot = decorated_output_qq_dims_q()
1413+ )
14121414 withCallingHandlers(
1413- if (input $ tabs == " Histogram" ) {
1414- c(decorated_output_dist_q(), decorated_output_summary_q(), decorated_output_test_q())
1415- } else if (input $ tabs == " QQplot" ) {
1416- c(decorated_output_qq_q(), decorated_output_summary_q(), decorated_output_test_q())
1417- },
1415+ c(out_q , output_summary_q(), test_q_out ),
14181416 warning = function (w ) {
14191417 if (grepl(" Restoring original content and adding only" , conditionMessage(w ))) {
14201418 invokeRestart(" muffleWarning" )
14211419 }
14221420 }
14231421 )
1422+ })
1423+
1424+ output $ t_stats <- DT :: renderDataTable(tests_r()[[" html" ]])
1425+
1426+ # Render R code.
1427+ source_code_r <- reactive(teal.code :: get_code(req(decorated_output_q())))
1428+
1429+ teal.widgets :: verbatim_popup_srv(
1430+ id = " rcode" ,
1431+ verbatim_content = source_code_r ,
1432+ title = " R Code for distribution"
14241433 )
1434+ decorated_output_q
14251435 })
14261436}
0 commit comments