@@ -158,7 +158,7 @@ exampleData_ICS <- visc_load_pdata(
158158# For this template, load VISCfunctions example data
159159data('exampleData_ICS', package = 'VISCfunctions', envir = environment())
160160
161- ICS_adata <- exampleData_ICS %>%
161+ ICS_adata <- exampleData_ICS |>
162162 filter(Population == "IFNg" & Group != 3)
163163```
164164
@@ -239,8 +239,8 @@ Objectives can be found on ATLAS, in the study protocol, or in the SAP.
239239``` {r response-testing, warning=FALSE}
240240
241241# example of using VISCfunctions::pairwise_test_bin for analysis
242- response_results <- ICS_adata %>%
243- group_by(Stim, Visit) %>%
242+ response_results <- ICS_adata |>
243+ group_by(Stim, Visit) |>
244244 group_modify(
245245 ~pairwise_test_bin(
246246 x = .$response,
@@ -252,15 +252,15 @@ response_results <- ICS_adata %>%
252252 latex_output = TRUE,
253253 verbose = FALSE
254254 )
255- ) %>%
255+ ) |>
256256 ungroup()
257257```
258258
259259``` {r magnitude-testing, warning=FALSE}
260260
261261# example of using VISCfunctions::pairwise_test_cont for analysis
262- magnitude_results <- ICS_adata %>%
263- group_by(Stim, Visit, Population) %>%
262+ magnitude_results <- ICS_adata |>
263+ group_by(Stim, Visit, Population) |>
264264 group_modify(
265265 ~pairwise_test_cont(
266266 x = .$PercentCellNet,
@@ -272,7 +272,7 @@ magnitude_results <- ICS_adata %>%
272272 digits = 3,
273273 verbose = FALSE
274274 )
275- ) %>%
275+ ) |>
276276 ungroup()
277277```
278278
@@ -307,14 +307,14 @@ See Figure `r insert_ref("fig:example-plot")` and Table `r insert_ref("tab:examp
307307
308308``` {r example-plot, fig.scap="Shorter caption for List of Figures.", fig.cap= "Longer caption that shows under the figure. Explain everything needed to understand the figure here."}
309309
310- plt_data <- ICS_adata %>%
310+ plt_data <- ICS_adata |>
311311 mutate(
312312 Group = factor(Group),
313313 response_and_group = case_when(response == 0 ~ 'Non-Responders',
314314 response == 1 ~ paste("Group", Group, '(Responders)'))
315315 )
316316
317- plt_data %>%
317+ plt_data |>
318318 ggplot(aes(x = Group,
319319 y = pmax(PercentCellNet, 0.005),
320320 shape = response_and_group,
@@ -324,7 +324,7 @@ plt_data %>%
324324 scale_color_visc() +
325325 scale_shape_visc() +
326326 geom_boxplot(
327- data = plt_data %>% filter(response == 1),
327+ data = plt_data |> filter(response == 1),
328328 fill = NA, lwd = .5, outlier.colour = NA
329329 ) +
330330 scale_y_log10(
@@ -346,8 +346,8 @@ plt_data %>%
346346
347347``` {r example-tab, results="asis", warning=kable_warnings}
348348
349- magnitude_tab <- magnitude_results %>%
350- select(-Population, -contains("Perfect")) %>%
349+ magnitude_tab <- magnitude_results |>
350+ select(-Population, -contains("Perfect")) |>
351351 rename("Median (Range)" = Median_Min_Max, 'Mean (SD)' = Mean_SD)
352352
353353caption_short <- "Short caption to show in List of Tables."
@@ -356,15 +356,15 @@ caption <- "Long caption to show above table. Explain everything needed to under
356356
357357if (output_type == 'latex') {
358358
359- magnitude_tab %>%
359+ magnitude_tab |>
360360 mutate(
361361 MagnitudeTest = pretty_pvalues(
362362 MagnitudeTest, output_type = output_type, sig_alpha = .1,
363363 background = "yellow",
364364 bold = if_else(pandoc_markup , TRUE, FALSE),
365365 italic = if_else(pandoc_markup , TRUE, FALSE)
366366 )
367- ) %>%
367+ ) |>
368368 kable(
369369 format = output_type,
370370 longtable = FALSE,
@@ -373,30 +373,30 @@ if (output_type == 'latex') {
373373 escape = FALSE,
374374 caption.short = caption_short,
375375 caption = caption
376- ) %>%
376+ ) |>
377377 kable_styling(
378378 font_size = 8,
379379 # Note scale_down will overwrite font_size specifications
380380 latex_options = c("hold_position", "scale_down", "repeat_header")
381- ) %>%
381+ ) |>
382382 collapse_rows(
383383 columns = 1:2,
384384 row_group_label_position = "identity",
385385 latex_hline = "full"
386- ) %>%
386+ ) |>
387387 kableExtra::footnote("SD: standard deviation.", threeparttable = TRUE)
388388
389389} else {
390390
391391 # flextable version of table for Word doc output
392392
393- magnitude_tab %>%
394- mutate(MagnitudeTest = round_away_0(MagnitudeTest, 3)) %>%
395- flextable() %>%
396- bg(i = ~ MagnitudeTest < .1, j = "MagnitudeTest", bg = "yellow") %>%
397- set_caption(caption) %>%
398- fontsize(size = 7, part = "all") %>%
399- merge_v(j = 1:2) %>% # equivalent of collapse_rows
393+ magnitude_tab |>
394+ mutate(MagnitudeTest = round_away_0(MagnitudeTest, 3)) |>
395+ flextable() |>
396+ bg(i = ~ MagnitudeTest < .1, j = "MagnitudeTest", bg = "yellow") |>
397+ set_caption(caption) |>
398+ fontsize(size = 7, part = "all") |>
399+ merge_v(j = 1:2) |> # equivalent of collapse_rows
400400 add_footer_lines("SD: standard deviation.")
401401
402402}
@@ -418,20 +418,20 @@ tbl_caption <- "Session reproducibility information"
418418if (output_type == 'latex') {
419419
420420 # format nicely for PDF with kable and kableExtra
421- my_session_info$platform_table %>%
422- kable(booktabs = TRUE, linesep = "", caption = tbl_caption) %>%
423- kable_styling() %>%
424- column_spec(1, width = "1in") %>%
421+ my_session_info$platform_table |>
422+ kable(booktabs = TRUE, linesep = "", caption = tbl_caption) |>
423+ kable_styling() |>
424+ column_spec(1, width = "1in") |>
425425 column_spec(2, width = "5.5in")
426426
427427} else {
428428
429429 # format nicely for Word with flextable
430- my_session_info$platform_table %>%
431- flextable() %>%
432- set_caption(tbl_caption) %>%
433- set_table_properties(layout = "fixed") %>% # to allow overriding automatic column width
434- flextable::width(1, 1, unit = "in") %>%
430+ my_session_info$platform_table |>
431+ flextable() |>
432+ set_caption(tbl_caption) |>
433+ set_table_properties(layout = "fixed") |> # to allow overriding automatic column width
434+ flextable::width(1, 1, unit = "in") |>
435435 flextable::width(2, 5.5, unit = "in")
436436
437437}
@@ -446,10 +446,10 @@ tbl_caption <- "Package reproducibility information"
446446if (output_type == 'latex') {
447447
448448 # format nicely for PDF with kable and kableExtra
449- my_session_info$packages_table %>%
449+ my_session_info$packages_table |>
450450 kable(
451451 booktabs = TRUE, linesep = "", caption = tbl_caption, longtable = TRUE
452- ) %>%
452+ ) |>
453453 kable_styling(
454454 latex_options = 'repeat_header',
455455 repeat_header_method = 'replace'
@@ -458,8 +458,8 @@ if (output_type == 'latex') {
458458} else {
459459
460460 # format nicely for Word with flextable
461- my_session_info$packages_table %>%
462- flextable() %>%
461+ my_session_info$packages_table |>
462+ flextable() |>
463463 set_caption(tbl_caption)
464464
465465}
0 commit comments