diff --git a/pkgdown.yml b/pkgdown.yml index 7b1da7b..ebfe9aa 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.11 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-07-08T03:50Z +last_built: 2024-07-08T04:39Z urls: reference: https://ccsarapas.github.io/lighthouse/reference article: https://ccsarapas.github.io/lighthouse/articles diff --git a/reference/se_prop.html b/reference/se_prop.html index 1d71478..2dcefc5 100644 --- a/reference/se_prop.html +++ b/reference/se_prop.html @@ -60,7 +60,7 @@

Argumentsmin_var -

numeric. Minimum variance (n * p * (1 - p) for valid normal approximation of the binomial. See Details.

+

numeric. Minimum variance (n * p * (1 - p)) for valid normal approximation of the binomial. See Details.

low_var_action
@@ -69,8 +69,8 @@

Arguments

Details

-

Standard error of a proportion is calculated using the formula: -$$SE = \sqrt{\frac{p(1 - p)}{n}}$$

+

Standard error of a proportion is calculated using the formula:

+

$$SE = \sqrt{\frac{p(1 - p)}{n}}$$

This formula assumes that the binomial sampling distribution underlying the observed proportion can be approximated by a normal distribution. This assumption is valid when the proportion variance (np(1 - p)) is diff --git a/search.json b/search.json index 4753a23..c905be8 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://ccsarapas.github.io/lighthouse/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2021 lighthouse authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Casey Sarapas. Author, maintainer.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sarapas C (2024). lighthouse: Utility Functions Lighthouse Institute Projects. R package version 0.7.0, https://ccsarapas.github.io/lighthouse/, https://github.com/ccsarapas/lighthouse.","code":"@Manual{, title = {lighthouse: Utility Functions for Lighthouse Institute Projects}, author = {Casey Sarapas}, year = {2024}, note = {R package version 0.7.0, https://ccsarapas.github.io/lighthouse/}, url = {https://github.com/ccsarapas/lighthouse}, }"},{"path":"https://ccsarapas.github.io/lighthouse/index.html","id":"lighthouse","dir":"","previous_headings":"","what":"Utility Functions for Lighthouse Institute Projects","title":"Utility Functions for Lighthouse Institute Projects","text":"lighthouse package includes various utility functions used staff Lighthouse Institute, division Chestnut Health Systems.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Utility Functions for Lighthouse Institute Projects","text":"Install lighthouse package running:","code":"remotes::install_github(\"ccsarapas/lighthouse\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute common accuracy and agreement metrics — accuracy_stats","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"Given vector true_values one vectors test values (passed ...), computes sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), Cohen's kappa.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"","code":"accuracy_stats(.data, true_values, ..., include_counts = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"","code":"# create example data w predictors with different properties: ex_data <- tibble::tibble( actual = rbinom(250, 1, .3), # 250 cases, p(outcome) = .3 prediction1 = ifelse(runif(250) <= .05, 1L - actual, actual), # 5% error rate prediction2 = ifelse(runif(250) <= .15, 1L - actual, actual), # 15% error rate prediction3 = ifelse(runif(250) <= .35, 1L - actual, actual), # 35% error rate prediction4 = ifelse(runif(250) <= .15, 1L, actual), # 15% with positive bias prediction5 = ifelse(runif(250) <= .15, 0L, actual) # 15% with negative bias ) # testing predicted v actual values ex_data %>% accuracy_stats(actual, prediction1) #> # A tibble: 1 × 7 #> Predictor n Kappa Sensitivity Specificity PPV NPV #> #> 1 prediction1 250 0.845 0.901 0.947 0.890 0.952 # can test multiple predictors simultaneously ex_data %>% accuracy_stats(actual, prediction1:prediction5) #> # A tibble: 5 × 7 #> Predictor n Kappa Sensitivity Specificity PPV NPV #> #> 1 prediction1 250 0.845 0.901 0.947 0.890 0.952 #> 2 prediction2 250 0.628 0.840 0.822 0.694 0.914 #> 3 prediction3 250 0.213 0.593 0.639 0.440 0.766 #> 4 prediction4 250 0.828 1 0.882 0.802 1 #> 5 prediction5 250 0.846 0.802 1 1 0.914 # if `include_counts` = TRUE, will also return n of false positives, # false negatives, etc., as well as and observed and expected % agreement ex_data %>% accuracy_stats(actual, prediction1:prediction5, include_counts = TRUE) #> # A tibble: 5 × 13 #> Predictor n TP FP TN FN pAgreeObserved pAgreeExpected Kappa #> #> 1 prediction1 250 73 9 160 8 0.932 0.561 0.845 #> 2 prediction2 250 68 30 139 13 0.828 0.538 0.628 #> 3 prediction3 250 48 61 108 33 0.624 0.523 0.213 #> 4 prediction4 250 81 20 149 0 0.92 0.534 0.828 #> 5 prediction5 250 65 0 169 16 0.936 0.584 0.846 #> # ℹ 4 more variables: Sensitivity , Specificity , PPV , #> # NPV "},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":null,"dir":"Reference","previous_headings":"","what":"Add crossings to a dataframe for area charts — add_crossings","title":"Add crossings to a dataframe for area charts — add_crossings","text":"Augments dataframe x-values y = f(x) = 0. useful creating area charts different fills values less versus greater 0.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add crossings to a dataframe for area charts — add_crossings","text":"","code":"add_crossings(data, x, y, .by = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add crossings to a dataframe for area charts — add_crossings","text":"data data frame containing original x y values. x x-axis values. y y-axis values. .Grouping variable(s). Useful computing crossings faceted plots.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add crossings to a dataframe for area charts — add_crossings","text":"input data frame additional rows representing crossings (y = 0), two new columns: pos_neg: Indicates whether y-value positive (\"pos\") negative (\"neg\"). cross_grp: grouping variable segments crossings.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add crossings to a dataframe for area charts — add_crossings","text":"returned dataframe include columns pos_neg cross_group. Within geom_area(), cross_group mapped group, pos_neg mapped aesthetics fill color.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add crossings to a dataframe for area charts — add_crossings","text":"","code":"nile_flow <- tibble::tibble( Year = time(Nile), Flow = as.numeric(Nile), FlowDelta = (Flow - Flow[[1]]) / Flow[[1]] ) nile_flow_x0 <- add_crossings(nile_flow, Year, FlowDelta) ggplot2::ggplot(nile_flow_x0, ggplot2::aes(Year, FlowDelta)) + ggplot2::geom_area( ggplot2::aes(group = cross_grp, color = pos_neg, fill = pos_neg), alpha = 0.25, show.legend = FALSE ) + ggplot2::geom_hline(yintercept = 0, linewidth = 0.25) + ggplot2::scale_color_manual( values = c(\"darkred\", \"blue\"), aesthetics = c(\"color\", \"fill\") ) + ggplot2::scale_y_continuous( \"Nile River Annual Flow:\\n% Change from 1871\", labels = scales::percent ) + ggplot2::theme_minimal()"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_empty_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add empty rows — add_empty_rows","title":"Add empty rows — add_empty_rows","text":"Adds number empty rows passed .nrows (default 1) positions passed ... Vectorized ., ., .nrows.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_empty_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add empty rows — add_empty_rows","text":"","code":"add_empty_rows(.data, .before = NULL, .after = NULL, .nrows = 1)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":null,"dir":"Reference","previous_headings":"","what":"Add header rows to a table — add_header","title":"Add header rows to a table — add_header","text":"Inserts header rows using unique values .","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add header rows to a table — add_header","text":"","code":"add_header( data, from, to, skip_single_row = FALSE, indent = \"\", drop_from = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add header rows to a table — add_header","text":"","code":"dplyr::starwars %>% head(13) %>% dplyr::arrange(species) %>% add_header(from = species, to = name, indent = \" \") #> # A tibble: 16 × 13 #> name height mass hair_color skin_color eye_color birth_year sex gender #> #> 1 \"Droid\" NA NA NA NA NA NA NA NA #> 2 \" C-3P… 167 75 NA gold yellow 112 none mascu… #> 3 \" R2-D… 96 32 NA white, bl… red 33 none mascu… #> 4 \" R5-D… 97 32 NA white, red red NA none mascu… #> 5 \"Human\" NA NA NA NA NA NA NA NA #> 6 \" Luke… 172 77 blond fair blue 19 male mascu… #> 7 \" Dart… 202 136 none white yellow 41.9 male mascu… #> 8 \" Leia… 150 49 brown light brown 19 fema… femin… #> 9 \" Owen… 178 120 brown, gr… light blue 52 male mascu… #> 10 \" Beru… 165 75 brown light blue 47 fema… femin… #> 11 \" Bigg… 183 84 black light brown 24 male mascu… #> 12 \" Obi-… 182 77 auburn, w… fair blue-gray 57 male mascu… #> 13 \" Anak… 188 84 blond fair blue 41.9 male mascu… #> 14 \" Wilh… 180 NA auburn, g… fair blue 64 male mascu… #> 15 \"Wookie… NA NA NA NA NA NA NA NA #> 16 \" Chew… 228 112 brown unknown blue 200 male mascu… #> # ℹ 4 more variables: homeworld , films , vehicles , #> # starships "},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a plot to a PowerPoint slide — add_plot_slide","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"function adds new slide PowerPoint presentation plot centered beneath title, scaled large possible within specified margins preserving aspect ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"","code":"add_plot_slide( pptx, title = NULL, plot = ggplot2::last_plot(), w = 7, h = 4, bg = \"white\", w_margin = 0.15, h_margin = 0.15, layout = \"Title and Content\", ... )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"pptx object class rpptx, created officer::read_pptx() title optional slide title plot plot add. Default last plot created. w plot width inches h plot height inches bg background color plot area w_margin horizontal margin inches h_margin vertical margin inches layout slide layout use ... additional arguments passed officer::ph_with()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"updated rpptx object","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"","code":"if (FALSE) { # \\dontrun{ library(ggplot2) library(officer) plot <- ggplot(mtcars, aes(mpg, wt)) + geom_point() pptx <- read_pptx() pptx <- pptx |> add_plot_slide(\"Larger Elements\", plot, w = 5, h = 3.5) |> add_plot_slide(\"Smaller Elements\", plot, w = 10, h = 7) |> add_plot_slide(\"Wider\", plot, w = 9, h = 3) |> add_plot_slide(\"Taller\", plot, w = 4, h = 6) path <- paste0(tempfile(), \".pptx\") print(pptx, target = path) file.open(path) invisible(file.remove(path)) } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":null,"dir":"Reference","previous_headings":"","what":"Add empty rows at specified values in a column — add_rows_at_value","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"Adds empty row(s) based specified value(s) col. default, insert one empty row last occurrence col value passed vals.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"","code":"add_rows_at_value( .data, col, vals, where = c(\"after_last\", \"before_first\", \"after_each\", \"before_each\"), no_match = c(\"error\", \"warn\", \"ignore\"), nrows = 1, ... )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add empty rows at specified values in a column — add_rows_at_value","text":".data data frame data frame extension. col column search values. vals character vector value(s) search col. insert rows relative values vals. nrows number empty rows insert location. ... dots included support error-checking must empty. nomatch value vals appear col.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"updated version .data new empty rows inserted.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"pre-release version function, used lighthouse code, values search passed ... unquoted symbols. Values must now now instead passed vals character vector. arguments ..nrows also renamed nrows. function attempt detect give informative warning called \"old\" parameters (e.g., deprecated argument list symbols rather character vector). Also see syms_to_chr(), provided utility adapting old code.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"","code":"set.seed(13) ex_data <- tibble::tibble( category = sort(sample(LETTERS[1:3], 10, replace = TRUE)), var = round(runif(10), 2) ) add_rows_at_value(ex_data, category, c(\"A\", \"B\")) #> # A tibble: 12 × 2 #> category var #> #> 1 A 0.87 #> 2 A 0.68 #> 3 A 0.14 #> 4 A 0.55 #> 5 NA NA #> 6 B 0.68 #> 7 B 0.53 #> 8 B 0.09 #> 9 B 0.62 #> 10 NA NA #> 11 C 0.03 #> 12 C 0.46 add_rows_at_value(ex_data, category, c(\"A\", \"C\"), where = \"after_each\") #> # A tibble: 16 × 2 #> category var #> #> 1 A 0.87 #> 2 NA NA #> 3 A 0.68 #> 4 NA NA #> 5 A 0.14 #> 6 NA NA #> 7 A 0.55 #> 8 NA NA #> 9 B 0.68 #> 10 B 0.53 #> 11 B 0.09 #> 12 B 0.62 #> 13 C 0.03 #> 14 NA NA #> 15 C 0.46 #> 16 NA NA add_rows_at_value( ex_data, category, unique(ex_data$category), where = \"before_first\", nrows = 2 ) #> # A tibble: 16 × 2 #> category var #> #> 1 NA NA #> 2 NA NA #> 3 A 0.87 #> 4 A 0.68 #> 5 A 0.14 #> 6 A 0.55 #> 7 NA NA #> 8 NA NA #> 9 B 0.68 #> 10 B 0.53 #> 11 B 0.09 #> 12 B 0.62 #> 13 NA NA #> 14 NA NA #> 15 C 0.03 #> 16 C 0.46"},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"Returns sum, maximum, minimum input values, similar base::sum(), min(), max(). Unlike base functions, variants return NA values NA na.rm = TRUE. (base::sum(), min(), max() return 0, -Inf, Inf, respectively, situation). Also unlike base functions, na.rm TRUE default (since typical use case).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"","code":"sum_if_any(..., na.rm = TRUE) max_if_any(..., na.rm = TRUE) min_if_any(..., na.rm = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"... numeric, logical, (max_if_any() min_if_any()) character vectors. na.rm logical. missing values (including NaN) removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"","code":"some_na <- c(1, 2, NA) all_na <- c(NA, NA, NA) # unlike base functions, `na.rm = TRUE` by default max(some_na) #> [1] NA max_if_any(some_na) #> [1] 2 # unlike base functions, returns 0 when `na.rm = TRUE` and all inputs are `NA` sum(all_na, na.rm = TRUE) #> [1] 0 sum_if_any(all_na) #> [1] NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether multiple values are in a vector — any-all-in","title":"Test whether multiple values are in a vector — any-all-in","text":"infix operators test whether left-hand side elements occur right-hand side.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether multiple values are in a vector — any-all-in","text":"","code":"lhs %all_in% rhs lhs %any_in% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test whether multiple values are in a vector — any-all-in","text":"%all_in% returns TRUE elements left operand (lhs) found right operand (rhs). Equivalent (lhs %% rhs). %any_in% returns TRUE elements left operand (lhs) found right operand (rhs). Equivalent (lhs %% rhs).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test whether multiple values are in a vector — any-all-in","text":"","code":"maybe_states <- c(\"Idaho\", \"Illinois\", \"North Tuba\", \"Maine\") maybe_states %any_in% state.name # TRUE #> [1] TRUE maybe_states %all_in% state.name # FALSE #> [1] FALSE rm(maybe_states)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":null,"dir":"Reference","previous_headings":"","what":"Return asterisks corresponding to p-values — asterisks","title":"Return asterisks corresponding to p-values — asterisks","text":"Returns asterisks indicating significance levels vector p values.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return asterisks corresponding to p-values — asterisks","text":"","code":"asterisks( p, trends = TRUE, levels = c(0.1, 0.05, 0.01, 0.001), marks = c(sig = \"*\", trend = \"+\", ns = NA_character_), include_key = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return asterisks corresponding to p-values — asterisks","text":"p numeric vector p-values. trends logical. trends (e.g., .05 < p < .10) marked? levels numeric vector demarcating ranges p values receive unique significance marks. marks named character vector specifying marks significance, trend, non-significance. include_key logical. key significance marks included attribute?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return asterisks corresponding to p-values — asterisks","text":"character vector asterisks corresponding p-values. include_key = TRUE, vector 'key' attribute indicating significance levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return asterisks corresponding to p-values — asterisks","text":"","code":"p <- c(0.5, 0.09, 0.03, 0.008, 0.0003) tibble::tibble(p, sig = asterisks(p)) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 NA #> 2 0.09 + #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** tibble::tibble(p, sig = asterisks(p, trends = FALSE)) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 NA #> 2 0.09 NA #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** tibble::tibble(p, sig = asterisks(p, trends = FALSE, marks = c(ns = \"ns\"))) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 ns #> 2 0.09 ns #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** asterisks(p, include_key = TRUE) #> [1] + * ** *** #> attr(,\"key\") #> *** ** * + #> 0.001 0.010 0.050 0.100 #> Levels: *** ** * +"},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":null,"dir":"Reference","previous_headings":"","what":"Find the nth or next business day — bizday","title":"Find the nth or next business day — bizday","text":"nth_bizday() returns nth business day given date, based CHS, Illinois, federal holidays. next_bizday() wrapper ","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find the nth or next business day — bizday","text":"","code":"nth_bizday( x, n, include_today = FALSE, holidays = c(\"Chestnut\", \"Illinois\", \"federal\") ) next_bizday( x, include_today = FALSE, holidays = c(\"Chestnut\", \"Illinois\", \"federal\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find the nth or next business day — bizday","text":"x date vector dates. n integer indicating ow many business days forward find. include_today logical indicating whether x counted one day (assuming business day)? holidays character indicating set holidays use.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find the nth or next business day — bizday","text":"nth_bizday returns nth business day provided date(s). next_bizday returns next business day provided date(s).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Find the nth or next business day — bizday","text":"","code":"next_bizday(as.Date(\"2024-07-02\")) #> [1] \"2024-07-03\" nth_bizday(as.Date(\"2024-07-02\"), 5) #> [1] \"2024-07-10\" nth_bizday(as.Date(\"2024-07-02\"), 5, include_today = TRUE) #> [1] \"2024-07-09\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cascade.html","id":null,"dir":"Reference","previous_headings":"","what":"Utilities for service cascades — cascade","title":"Utilities for service cascades — cascade","text":"Functions working service cascades.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cascade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utilities for service cascades — cascade","text":"","code":"cascade_fill_bwd(data, vars) cascade_fill_fwd(data, vars, fill = c(\"NA\", \"FALSE\")) cascade_summarize(data, vars)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether a confidence interval excludes a given value — ci_sig","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"Tests whether confidence interval excldes specified reference value. generally null value relevant test, excluding value indicates test statistically significant.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"","code":"ci_sig( ll, ul, reference = 1, return = c(\"logical\", \"asterisks\"), marks = c(\"*\", NA_character_) )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"ll numeric vector containing confidence interval lower limits. ul numeric vector containing corresponding upper limits. reference value check . generally null value relevant test (e.g., 1 odds ratios, 0 beta coefficients). return \"logical\", return logical vector indicating whether confidence interval excludes reference. asterisks, return character vector, using characters passed marks. marks length-2 vector specifying strings mark significant non-significant results return = \"asterisks\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"return = \\\"logical\\\" (default), logical vector. return = \\\"asterisks\\\", character vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"","code":"beta_CIs <- glm( Survived ~ Sex * Age, family = binomial, weights = Freq, data = as.data.frame(Titanic) ) %>% confint() #> Waiting for profiling to be done... OR_CIs <- tibble::as_tibble(exp(beta_CIs), rownames = \"term\") beta_CIs <- tibble::as_tibble(beta_CIs, rownames = \"term\") beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`)) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 TRUE #> 2 SexFemale -0.0834 1.48 FALSE #> 3 AgeAdult -1.69 -0.669 TRUE #> 4 SexFemale:AgeAdult 0.918 2.56 FALSE beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, return = \"asterisks\")) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 * #> 2 SexFemale -0.0834 1.48 NA #> 3 AgeAdult -1.69 -0.669 * #> 4 SexFemale:AgeAdult 0.918 2.56 NA beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, return = \"asterisks\", marks = c(\"*\", \"ns\"))) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 * #> 2 SexFemale -0.0834 1.48 ns #> 3 AgeAdult -1.69 -0.669 * #> 4 SexFemale:AgeAdult 0.918 2.56 ns OR_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, reference = 1, return = \"asterisks\")) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) 0.503 1.35 NA #> 2 SexFemale 0.920 4.39 NA #> 3 AgeAdult 0.185 0.512 * #> 4 SexFemale:AgeAdult 2.50 12.9 *"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Cohen's w — cohen_w","title":"Compute Cohen's w — cohen_w","text":"Cohen's w effect size measure associations nominal variables, generally used conjunction chi-squared tests. cohen_w() computes Cohen's w results chi-squared test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Cohen's w — cohen_w","text":"","code":"cohen_w(chisq)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Cohen's w — cohen_w","text":"chisq \"htest\" object returned stats::chisq.test().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Cohen's w — cohen_w","text":"","code":"chisq_out <- chisq.test(ggplot2::diamonds$cut, ggplot2::diamonds$color) cohen_w(chisq_out) #> [1] 0.07584867"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get information about data frame columns — cols_info","title":"Get information about data frame columns — cols_info","text":"Returns summary column's class, type, missing data. data frame imported SPSS .sav file \\\"labelled\\\" package installed, SPSS variable labels also included.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get information about data frame columns — cols_info","text":"","code":"cols_info(x, zap_spss = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get information about data frame columns — cols_info","text":"x data frame. zap_spss TRUE (default) \\\"labelled\\\" package available, convert SPSS-style labeled columns standard R columns. Ignored \\\"labelled\\\" installed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get information about data frame columns — cols_info","text":"tibble row column x, containing: column: Column name class: Column class type: Column type valid_n: Number non-missing values valid_pct: Percentage non-missing values label: SPSS variable label (applicable)","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get information about data frame columns — cols_info","text":"","code":"cols_info(dplyr::starwars) #> # A tibble: 14 × 5 #> column class type valid_n valid_pct #> #> 1 name character character 87 1 #> 2 height integer integer 81 0.931 #> 3 mass numeric double 59 0.678 #> 4 hair_color character character 82 0.943 #> 5 skin_color character character 87 1 #> 6 eye_color character character 87 1 #> 7 birth_year numeric double 43 0.494 #> 8 sex character character 83 0.954 #> 9 gender character character 83 0.954 #> 10 homeworld character character 77 0.885 #> 11 species character character 83 0.954 #> 12 films list list 87 1 #> 13 vehicles list list 87 1 #> 14 starships list list 87 1"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":null,"dir":"Reference","previous_headings":"","what":"Count duplicates across specified columns — count_duplicates","title":"Count duplicates across specified columns — count_duplicates","text":"variant dplyr::count() returns number duplicate observations across specified columns. Returns number unique duplicated values, well total number duplicated observations.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count duplicates across specified columns — count_duplicates","text":"","code":"count_duplicates(.data, ..., na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count duplicates across specified columns — count_duplicates","text":".data data frame. ... Columns use duplicate checks. empty, columns used. na.rm TRUE, rows containing NA specified columns removed counting duplicates.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count duplicates across specified columns — count_duplicates","text":"data frame columns: instances: number times unique value duplicated n_unique: number unique values duplicated instances times n_total: total number observations duplicated instances times","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count duplicates across specified columns — count_duplicates","text":"","code":"df <- tibble::tibble( x = c(1, 1, 2, 3, 3), y = c('a', 'a', 'b', 'c', 'c') ) count_duplicates(df) #> # A tibble: 1 × 3 #> instances n_unique n_total #> #> 1 5 1 5 count_duplicates(df, x) #> # A tibble: 2 × 3 #> instances n_unique n_total #> #> 1 1 1 1 #> 2 2 2 4 count_duplicates(df, y) #> # A tibble: 2 × 3 #> instances n_unique n_total #> #> 1 1 1 1 #> 2 2 2 4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations for multiple variables — count_multiple","title":"Count observations for multiple variables — count_multiple","text":"variant dplyr::count() returns frequencies (optionally) proportions column passed ....","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations for multiple variables — count_multiple","text":"","code":"count_multiple( .data, ..., .pct = TRUE, wt = NULL, sort = FALSE, name = NULL, na.rm = FALSE, .by = NULL, .drop = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations for multiple variables — count_multiple","text":".data data frame. ... Columns count frequencies . Can named expressions. .pct TRUE (default), include percentages. sort TRUE, sort output frequency. name Name frequency column. Default \\\"n\\\". na.rm TRUE, remove rows NA values. .selection columns group just operation, functioning alternative dplyr::group_by(). Percentages computed within group rather grand total. See examples. .drop TRUE (default), drop unused factor levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations for multiple variables — count_multiple","text":"data frame columns: grouping variables input data specified .. Variable: name column counted. Value: unique values counted column. n: frequency unique value. pct: (.pct = TRUE) percentage count represents within variable.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations for multiple variables — count_multiple","text":"","code":"iris %>% count_multiple(Species, Sepal.Length > 5) #> # A tibble: 5 × 4 #> Variable Value n pct #> #> 1 Species setosa 50 0.333 #> 2 Species versicolor 50 0.333 #> 3 Species virginica 50 0.333 #> 4 Sepal.Length > 5 FALSE 32 0.213 #> 5 Sepal.Length > 5 TRUE 118 0.787 ## note effects of grouping # no grouping ggplot2::mpg %>% count_multiple(year, drv, cyl) #> # A tibble: 9 × 4 #> Variable Value n pct #> #> 1 year 1999 117 0.5 #> 2 year 2008 117 0.5 #> 3 drv 4 103 0.440 #> 4 drv f 106 0.453 #> 5 drv r 25 0.107 #> 6 cyl 4 81 0.346 #> 7 cyl 5 4 0.0171 #> 8 cyl 6 79 0.338 #> 9 cyl 8 70 0.299 # grouping w `group_by()`: counts and % nested within groups, output is grouped ggplot2::mpg %>% dplyr::group_by(year) %>% count_multiple(drv, cyl) #> # A tibble: 13 × 5 #> # Groups: year [2] #> year Variable Value n pct #> #> 1 1999 drv 4 49 0.419 #> 2 1999 drv f 57 0.487 #> 3 1999 drv r 11 0.0940 #> 4 2008 drv 4 54 0.462 #> 5 2008 drv f 49 0.419 #> 6 2008 drv r 14 0.120 #> 7 1999 cyl 4 45 0.385 #> 8 1999 cyl 6 45 0.385 #> 9 1999 cyl 8 27 0.231 #> 10 2008 cyl 4 36 0.308 #> 11 2008 cyl 5 4 0.0342 #> 12 2008 cyl 6 34 0.291 #> 13 2008 cyl 8 43 0.368 # grouping w `.by`: counts and % nested within groups, output isn't grouped ggplot2::mpg %>% count_multiple(drv, cyl, .by = year) #> # A tibble: 13 × 5 #> year Variable Value n pct #> #> 1 1999 drv 4 49 0.419 #> 2 1999 drv f 57 0.487 #> 3 1999 drv r 11 0.0940 #> 4 2008 drv 4 54 0.462 #> 5 2008 drv f 49 0.419 #> 6 2008 drv r 14 0.120 #> 7 1999 cyl 4 45 0.385 #> 8 1999 cyl 6 45 0.385 #> 9 1999 cyl 8 27 0.231 #> 10 2008 cyl 4 36 0.308 #> 11 2008 cyl 5 4 0.0342 #> 12 2008 cyl 6 34 0.291 #> 13 2008 cyl 8 43 0.368"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_na.html","id":null,"dir":"Reference","previous_headings":"","what":"Count NA values by group — count_na","title":"Count NA values by group — count_na","text":"Returns patterns missingness across one variables, number cases pattern.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_na.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count NA values by group — count_na","text":"","code":"count_na( .data, ..., .label_missing = NA_character_, .label_valid = \"OK\", .add_percent = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations with percentage — count_pct","title":"Count observations with percentage — count_pct","text":"variant dplyr::count() includes column showing percentage total observations group.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations with percentage — count_pct","text":"","code":"count_pct( .data, ..., na.rm = FALSE, .by = NULL, wt = NULL, sort = FALSE, .drop = dplyr::group_by_drop_default() )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations with percentage — count_pct","text":"... Variables group . passed dplyr::count(). na.rm TRUE, removes rows NA values calculations. .selection columns group just operation, functioning alternative dplyr::group_by(). Percentages computed within group rather grand total. See examples. wt Frequency weights. Can NULL variable: NULL (default), counts number rows group. variable, computes sum(wt) group. sort TRUE, show largest groups top. .drop Handling factor levels appear data, passed group_by(). count(): FALSE include counts empty groups (.e. levels factors exist data). add_count(): deprecated since actually affect output.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations with percentage — count_pct","text":"data frame columns grouping variables, n (count observations group), pct (percentage total observations group).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Count observations with percentage — count_pct","text":"Percentages within subgroups can obtained grouping group_by","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations with percentage — count_pct","text":"","code":"library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union ## note effect of `na.rm` on percentages dplyr::starwars %>% count_pct(gender) #> # A tibble: 3 × 3 #> gender n pct #> #> 1 feminine 17 0.195 #> 2 masculine 66 0.759 #> 3 NA 4 0.0460 dplyr::starwars %>% count_pct(gender, na.rm = TRUE) #> # A tibble: 2 × 3 #> gender n pct #> #> 1 feminine 17 0.205 #> 2 masculine 66 0.795 ## note effect of grouping on percentages # no grouping: % of grand total ggplot2::mpg %>% count_pct(year, cyl) #> # A tibble: 7 × 4 #> year cyl n pct #> #> 1 1999 4 45 0.192 #> 2 1999 6 45 0.192 #> 3 1999 8 27 0.115 #> 4 2008 4 36 0.154 #> 5 2008 5 4 0.0171 #> 6 2008 6 34 0.145 #> 7 2008 8 43 0.184 # grouping w `group_by()`: % of group, output is grouped ggplot2::mpg %>% dplyr::group_by(year) %>% count_pct(cyl) #> # A tibble: 7 × 4 #> # Groups: year [2] #> year cyl n pct #> #> 1 1999 4 45 0.385 #> 2 1999 6 45 0.385 #> 3 1999 8 27 0.231 #> 4 2008 4 36 0.308 #> 5 2008 5 4 0.0342 #> 6 2008 6 34 0.291 #> 7 2008 8 43 0.368 # grouping w `.by`: % of group, output isn't grouped ggplot2::mpg %>% count_pct(cyl, .by = year) #> # A tibble: 7 × 4 #> year cyl n pct #> #> 1 1999 4 45 0.385 #> 2 1999 6 45 0.385 #> 3 1999 8 27 0.231 #> 4 2008 4 36 0.308 #> 5 2008 5 4 0.0342 #> 6 2008 6 34 0.291 #> 7 2008 8 43 0.368"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":null,"dir":"Reference","previous_headings":"","what":"Count unique values in data frame columns — count_unique","title":"Count unique values in data frame columns — count_unique","text":"variant dplyr::count() returns number unique values across set columns data frame.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count unique values in data frame columns — count_unique","text":"","code":"count_unique(.data, ..., name = \"n_unique\", na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count unique values in data frame columns — count_unique","text":".data data frame. ... columns count unique values across. name name give unique count column. na.rm exclude NAs counts?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count unique values in data frame columns — count_unique","text":"","code":"mtcars %>% count_unique(cyl, gear) #> n_unique #> 1 8 mtcars %>% count_unique(cyl, gear, carb, name = \"unique_combos\") #> unique_combos #> 1 12"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations with totals row — count_with_total","title":"Count observations with totals row — count_with_total","text":"variant dplyr::count() adds row column totals. Totals computed first column passed ... unless otherwise specified totals_for.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations with totals row — count_with_total","text":"","code":"count_with_total( .data, ..., totals_for = NULL, label = \"Total\", first_row = FALSE, wt = NULL, sort = FALSE, name = NULL, .drop = dplyr::group_by_drop_default() )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations with totals row — count_with_total","text":"... Variables group . totals_for variable total . omitted, defaults first variable .... label label totals row. Defaults \"Total\". first_row TRUE, totals row placed first output. FALSE (default), placed last. wt Frequency weights. Can NULL variable: NULL (default), counts number rows group. variable, computes sum(wt) group. sort TRUE, show largest groups top. name name new column output. omitted, default n. already column called n, use nn. column called n nn, 'll use nnn, , adding ns gets new name. .drop Handling factor levels appear data, passed dplyr::group_by(). FALSE include counts empty groups (.e. levels factors exist data).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations with totals row — count_with_total","text":"data frame counts grouping level, along \"totals\" row column totals totaled variable.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations with totals row — count_with_total","text":"","code":"mtcars %>% count_with_total(cyl) #> cyl n #> 1 4 11 #> 2 6 7 #> 3 8 14 #> 4 Total 32 mtcars %>% count_with_total(cyl, gear) #> cyl gear n #> 1 4 3 1 #> 2 4 4 8 #> 3 4 5 2 #> 4 6 3 2 #> 5 6 4 4 #> 6 6 5 1 #> 7 8 3 12 #> 8 8 5 2 #> 9 Total 3 15 #> 10 Total 4 12 #> 11 Total 5 5 mtcars %>% count_with_total(cyl, gear, totals_for = gear) #> cyl gear n #> 1 4 3 1 #> 2 4 4 8 #> 3 4 5 2 #> 4 4 Total 11 #> 5 6 3 2 #> 6 6 4 4 #> 7 6 5 1 #> 8 6 Total 7 #> 9 8 3 12 #> 10 8 5 2 #> 11 8 Total 14"},{"path":"https://ccsarapas.github.io/lighthouse/reference/crosstab.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross-tabulate observations — crosstab","title":"Cross-tabulate observations — crosstab","text":"Builds contingency table similar base::table(). Unlike base::table(), crosstab() pipe-friendly, outputs ordinary tibble / data.frame – e.g., retain structure exported csv. Currently supports two variables.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/crosstab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross-tabulate observations — crosstab","text":"","code":"crosstab(.data, ..., .drop = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":null,"dir":"Reference","previous_headings":"","what":"Descending cumulative sum — cumsum_desc","title":"Descending cumulative sum — cumsum_desc","text":"Returns cumulative sum beginning last element x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Descending cumulative sum — cumsum_desc","text":"","code":"cumsum_desc(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Descending cumulative sum — cumsum_desc","text":"","code":"ggplot2::diamonds %>% dplyr::count(cut) %>% dplyr::mutate( or_worse = cumsum(n), or_better = cumsum_desc(n) ) #> # A tibble: 5 × 4 #> cut n or_worse or_better #> #> 1 Fair 1610 1610 53940 #> 2 Good 4906 6516 52330 #> 3 Very Good 12082 18598 47424 #> 4 Premium 13791 32389 35342 #> 5 Ideal 21551 53940 21551"},{"path":"https://ccsarapas.github.io/lighthouse/reference/d_to_OR.html","id":null,"dir":"Reference","previous_headings":"","what":"Conversion between Cohen's d and odds ratio — d_to_OR","title":"Conversion between Cohen's d and odds ratio — d_to_OR","text":"Functions convert Cohen's d odds ratio vice versa.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/d_to_OR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conversion between Cohen's d and odds ratio — d_to_OR","text":"","code":"d_to_OR(d) OR_to_d(OR)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/datetimes_to_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all datetimes in table to dates — datetimes_to_date","title":"Convert all datetimes in table to dates — datetimes_to_date","text":"Returns dataframe datetime columns (.e., class POSIXct POSIXlt) converted Date.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/datetimes_to_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all datetimes in table to dates — datetimes_to_date","text":"","code":"datetimes_to_date(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/days_diff.html","id":null,"dir":"Reference","previous_headings":"","what":"Number of days between two dates — days_diff","title":"Number of days between two dates — days_diff","text":"Returns number days two dates.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/days_diff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Number of days between two dates — days_diff","text":"","code":"days_diff(d1, d2, warn = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":null,"dir":"Reference","previous_headings":"","what":"Compare two data frames and show differences — df_compare","title":"Compare two data frames and show differences — df_compare","text":"Given two data frames dimensions column order, returns data frame including rows columns differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compare two data frames and show differences — df_compare","text":"","code":"df_compare(x, y, suffix = c(\".x\", \".y\"), keep = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compare two data frames and show differences — df_compare","text":"x, y pair data frames suffix suffixes indicate source data frame output. keep <[tidy-select][dplyr_tidy_select> Columns include output even differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compare two data frames and show differences — df_compare","text":"data frame rows columns differing values x y. Differing columns included twice, suffixes appended. Columns specified keep always included.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compare two data frames and show differences — df_compare","text":"","code":"x <- data.frame(id = 1:3, A = c(7, 8, 9), B = c(10, 20, 30), C = c(\"x\", \"y\", \"z\")) y <- data.frame(id = 1:3, A = c(7, 8, 99), B = c(10, 20, 30), C = c(\"X\", \"y\", \"Z\")) df_compare(x, y) #> A.x A.y C.x C.y #> 1 7 7 x X #> 2 9 99 z Z df_compare(x, y, keep = id) #> id A.x A.y C.x C.y #> 1 1 7 7 x X #> 2 3 9 99 z Z"},{"path":"https://ccsarapas.github.io/lighthouse/reference/discard_na.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove missing values — discard_na","title":"Remove missing values — discard_na","text":"Returns vector NAs removed. Similar stats::na.omit.default(), add attributes returned value.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/discard_na.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove missing values — discard_na","text":"","code":"discard_na(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Drop rows where all columns are NA — drop_na_rows","title":"Drop rows where all columns are NA — drop_na_rows","text":"Drops rows specified columns NA. columns specified, columns considered.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Drop rows where all columns are NA — drop_na_rows","text":"","code":"drop_na_rows(data, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Drop rows where all columns are NA — drop_na_rows","text":"data data frame. ... (Optional) Columns test NAs. specified, columns considered.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Drop rows where all columns are NA — drop_na_rows","text":"data frame rows removed contain NA values across (specified) columns.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Drop rows where all columns are NA — drop_na_rows","text":"","code":"dat <- tibble::tibble( x = c(NA, NA, 3), y = c(NA, NA, 4), z = c(5, NA, NA) ) drop_na_rows(dat) #> # A tibble: 2 × 3 #> x y z #> #> 1 NA NA 5 #> 2 3 4 NA drop_na_rows(dat, x, y) #> # A tibble: 1 × 3 #> x y z #> #> 1 3 4 NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":null,"dir":"Reference","previous_headings":"","what":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"tidy wrapper around dunn.test::dunn.test(). performs Dunn's test, non-parametric pairwise follow-Kruskal-Wallis test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"","code":"dunn_test( x, groups, data, p.adjust.method = c(\"holm\", \"hochberg\", \"bonferroni\", \"bh\", \"by\", \"sidak\", \"hs\", \"none\"), alpha = 0.05 )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"x numeric vector. groups vector factor giving group corresponding elements x. data data frame containing variables. p.adjust.method character. method adjusting p-values multiple comparisons. alpha numeric. alpha level.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"tibble columns: contrast: compared groups. statistic: Dunn's test statistic (z). adj.p.value: Adjusted p-value based specified p.adjust.method.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"","code":"mtcars2 <- transform(mtcars, cyl = factor(cyl)) kruskal.test(mpg ~ gear, data = mtcars2) #> #> \tKruskal-Wallis rank sum test #> #> data: mpg by gear #> Kruskal-Wallis chi-squared = 14.323, df = 2, p-value = 0.0007758 #> dunn_test(mpg, gear, data = mtcars2) #> # A tibble: 3 × 3 #> contrast statistic adj.p.value #> #> 1 3 - 4 -3.76 0.000253 #> 2 3 - 5 -1.65 0.0998 #> 3 4 - 5 1.14 0.127"},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if two objects have the same shape — eq_shape","title":"Test if two objects have the same shape — eq_shape","text":"Checks two objects x y shape, .e., dimensions length vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if two objects have the same shape — eq_shape","text":"","code":"eq_shape(x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test if two objects have the same shape — eq_shape","text":"x object. y object.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test if two objects have the same shape — eq_shape","text":"TRUE x y shape, FALSE otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test if two objects have the same shape — eq_shape","text":"","code":"eq_shape(1:5, 1:5) #> [1] TRUE eq_shape(1:5, 1:6) #> [1] FALSE eq_shape(matrix(1:6, nrow = 2), matrix(1:6, nrow = 3)) #> [1] FALSE eq_shape(matrix(1:6, nrow = 2), matrix(1:6, nrow = 2)) #> [1] TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_case_when.html","id":null,"dir":"Reference","previous_headings":"","what":"Results of case_when() as factor. — fct_case_when","title":"Results of case_when() as factor. — fct_case_when","text":"Wrapper dplyr::case_when(), result factor levels order passed .... Returns ordered factor .ordered TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_case_when.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results of case_when() as factor. — fct_case_when","text":"","code":"fct_case_when(..., .ordered = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse factor levels with additional controls — fct_collapse_alt","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"Collapses factor levels manually defined groups like forcats::fct_collapse(), additional options control behavior specified levels exist data order factor levels order listed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"","code":"fct_collapse_alt( .f, ..., other_level = NULL, reorder = TRUE, unknown_levels = c(\"ignore\", \"warn\", \"error\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":".f factor (character vector). ... series named character vectors. levels vector replaced name. other_level Value level used \"\" values named .... NULL, extra level created. reorder TRUE, collapsed levels ordered order listed ..., followed other_level specified, existing levels. unknown_levels handle levels listed ... present input factor .f. Options : \"ignore\": ignore unknown levels without warning (default), \"warn\": issue warning ignore unknown levels, \"error\": raise error.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"factor collapsed levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"","code":"f <- factor(c(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\")) fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\")) #> [1] AB AB c d EFG EFG #> Levels: EFG AB c d fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), reorder = FALSE) #> [1] AB AB c d EFG EFG #> Levels: AB c d EFG fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), other_level = \"other\") #> [1] AB AB other other EFG EFG #> Levels: EFG AB other # `unknown_levels = \"warn\"` mirrors behavior of `forcats::fct_collapse()` # \\donttest{ fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), unknown_levels = \"warn\") #> Warning: Unknown levels in `f`: g #> [1] AB AB c d EFG EFG #> Levels: EFG AB c d # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_filter.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter by and drop factor levels simultaneously — fct_filter","title":"Filter by and drop factor levels simultaneously — fct_filter","text":"Filters dataframe specified levels .fct, drops filtered levels .fct.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_filter.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter by and drop factor levels simultaneously — fct_filter","text":"","code":"fct_filter(.data, .fct, .keep = NULL, .drop = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert specified factor levels to NA — fct_na_if","title":"Convert specified factor levels to NA — fct_na_if","text":"Converts specified level(s) factor NA, removing levels factor. differs behavior dplyr::na_if(), (1) replaces values NA retains associated factor level, (2) can replace single value.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert specified factor levels to NA — fct_na_if","text":"","code":"fct_na_if(x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert specified factor levels to NA — fct_na_if","text":"x factor. y character vector levels convert NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert specified factor levels to NA — fct_na_if","text":"input factor specified levels converted NA removed levels.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert specified factor levels to NA — fct_na_if","text":"","code":"f <- factor(c(\"a\", \"b\", \"c\", \"a\")) fct_na_if(f, \"a\") #> [1] b c #> Levels: b c fct_na_if(f, c(\"a\", \"c\")) #> [1] b #> Levels: b # compare `na_if()` dplyr::na_if(f, \"a\") #> [1] b c #> Levels: a b c"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_reorder_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","title":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","text":"Reorders levels .f based variables passed ..., breaking ties using variable order passed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_reorder_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","text":"","code":"fct_reorder_n(.f, ..., .desc = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/filter_drop.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter by and drop a column simultaneously — filter_drop","title":"Filter by and drop a column simultaneously — filter_drop","text":"Filters dataframe specified values .col, drops .col.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/filter_drop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter by and drop a column simultaneously — filter_drop","text":"","code":"filter_drop(.data, .col, .keep = NULL, .drop = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify or remove columns with no data — find_na_cols","title":"Identify or remove columns with no data — find_na_cols","text":"find_na_cols() returns names columns .data values NA. drop_na_cols() returns dataset -NA columns removed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify or remove columns with no data — find_na_cols","text":"","code":"find_na_cols(.data, cols = tidyselect::everything()) drop_na_cols(.data, cols = tidyselect::everything(), quietly = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify or remove columns with no data — find_na_cols","text":".data data frame data frame extension (e.g. tibble). cols Columns check. quietly FALSE, print columns dropped.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine fiscal year from date — fiscal_year","title":"Determine fiscal year from date — fiscal_year","text":"Given date, returns corresponding fiscal year, start date, end date. fiscal_year function allows specifying fiscal year start month, ffy sfy_il convenience wrappers: ffy: Federal fiscal year (starts October) sfy_il: Illinois state fiscal year (starts July)","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine fiscal year from date — fiscal_year","text":"","code":"fiscal_year(x, type = c(\"year\", \"date_first\", \"date_last\"), fiscal_start = 1) ffy(x, type = c(\"year\", \"date_first\", \"date_last\")) sfy_il(x, type = c(\"year\", \"date_first\", \"date_last\"))"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine fiscal year from date — fiscal_year","text":"x date date-time object. type return: fiscal year (\"year\"), first day fiscal year (\"date_first\"), last day fiscal year (\"date_last\"). fiscal_start fiscal_year, month fiscal year starts (default 1 January).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine fiscal year from date — fiscal_year","text":"integer representing fiscal year Date representing start end fiscal year, depending type.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine fiscal year from date — fiscal_year","text":"","code":"dt <- as.Date(\"2023-08-15\") fiscal_year(dt) #> [1] 2023 fiscal_year(dt, fiscal_start = 7) #> [1] 2024 fiscal_year(dt, type = \"date_first\", fiscal_start = 7) #> [1] \"2023-07-01\" fiscal_year(dt, type = \"date_last\", fiscal_start = 7) #> [1] \"2024-06-30\" ffy(dt) #> [1] 2023 sfy_il(dt) #> [1] 2024"},{"path":"https://ccsarapas.github.io/lighthouse/reference/floor_month.html","id":null,"dir":"Reference","previous_headings":"","what":"Floor methods for date objects — floor_month","title":"Floor methods for date objects — floor_month","text":"floor_month() floor_week() simple wrappers around lubridate::floor_date() round first day month week. floor_days() rounds nearest n-day increment. Floors defined relative earliest date x, unless different start date passed start. Default behavior differs lubridate::floor_date(x, unit = \"{n} days\"), \"resets\" floor first month month. lubridate-like behavior can achieved setting reset_monthly = TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/floor_month.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Floor methods for date objects — floor_month","text":"","code":"floor_month(x) floor_week(x, week_start = getOption(\"lubridate.week.start\", 7)) floor_days(x, n = 1L, start = min(x, na.rm = TRUE), reset_monthly = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":null,"dir":"Reference","previous_headings":"","what":"Missing codes for GAIN ABS — gain_missing_codes","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"Labelled missings used GAIN datasets.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"","code":"gain_missing_codes"},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"named numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_ss_score.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute time period scores for GAIN-SS scales — gain_ss_score","title":"Compute time period scores for GAIN-SS scales — gain_ss_score","text":"Pass scale items .... return columns score lifetime, past year, past 90 days, past month positive items","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_ss_score.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute time period scores for GAIN-SS scales — gain_ss_score","text":"","code":"gain_ss_score(..., .prefix = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/get_col_types.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a dataframe's column types - DEPRECATED — get_col_types","title":"Summarize a dataframe's column types - DEPRECATED — get_col_types","text":"Deprecated favor cols_info(), provides information features stable. Returns class type column .data.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/get_col_types.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a dataframe's column types - DEPRECATED — get_col_types","text":"","code":"get_col_types(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ggview.html","id":null,"dir":"Reference","previous_headings":"","what":"Nicer ggplot rendering - DEPRECATED — ggview","title":"Nicer ggplot rendering - DEPRECATED — ggview","text":"function deprecated longer maintained. Improvements RStudio graphics make longer needed. Saves ggplot object .svg R temp directory, displays RStudio Viewer pane. Results better image quality Windows machines.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ggview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nicer ggplot rendering - DEPRECATED — ggview","text":"","code":"ggview( plot = ggplot2::last_plot(), width = NULL, height = NULL, type = c(\"svg\", \"png\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":null,"dir":"Reference","previous_headings":"","what":"Format and interpolate a string as character vector — glue_chr","title":"Format and interpolate a string as character vector — glue_chr","text":"wrapper around glue::glue() returns character vector rather \"glue\" object.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format and interpolate a string as character vector — glue_chr","text":"","code":"glue_chr(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format and interpolate a string as character vector — glue_chr","text":"... [expressions] Unnamed arguments taken expression string(s) format. Multiple inputs concatenated together formatting. Named arguments taken temporary variables available substitution.","code":"For `glue_data()`, elements in `...` override the values in `.x`."},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":null,"dir":"Reference","previous_headings":"","what":"Split dataframe by named groups — group_split_named","title":"Split dataframe by named groups — group_split_named","text":"Divides .data named list dataframes defined grouping structure. Grouping variables can optionally passed .... nested list returned one grouping variable .nested = TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split dataframe by named groups — group_split_named","text":"","code":"group_split_named( .data, ..., .keep = TRUE, .sep = \".\", .col_names = FALSE, .col_sep = \"_\", .nested = FALSE, .na.rm = FALSE, .add_groups = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Split dataframe by named groups — group_split_named","text":"","code":"by_cyl_gear1 <- mtcars %>% group_split_named(cyl, gear, .col_names = TRUE) by_cyl_gear1$cyl_6.gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4 by_cyl_gear2 <- mtcars %>% group_split_named(cyl, gear, .col_names = TRUE, .nested = TRUE) by_cyl_gear2$cyl_6 #> $gear_3 #> # A tibble: 2 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 2 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> #> $gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4 #> #> $gear_5 #> # A tibble: 1 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> by_cyl_gear2$cyl_6$gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Add ","title":"Add ","text":"Groups dataframe columns specified ... using dplyr::group_by(), adds additional group containing observations. Useful including \"total\" \"overall\" row summaries. one column passed ..., \"total\" group combine groups first column passed, unless different column specified .totals_for. Removing changing grouping structure calling group_with_total() aggregating may yield inaccurate results.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add ","text":"","code":"group_with_total( .data, ..., .totals_for = NULL, .label = \"Total\", .add = FALSE, .drop = dplyr::group_by_drop_default(.data), .first_row = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add ","text":"","code":"ggplot2::mpg %>% group_with_total(class) %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> # A tibble: 8 × 4 #> class n cty hwy #> #> 1 2seater 5 15.4 24.8 #> 2 compact 47 20.1 28.3 #> 3 midsize 41 18.8 27.3 #> 4 minivan 11 15.8 22.4 #> 5 pickup 33 13 16.9 #> 6 subcompact 35 20.4 28.1 #> 7 suv 62 13.5 18.1 #> 8 Total 234 16.9 23.4 ggplot2::mpg %>% group_with_total(year, drv, .label = \"all years\") %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> `summarise()` has grouped output by 'year'. You can override using the #> `.groups` argument. #> # A tibble: 9 × 5 #> # Groups: year [3] #> year drv n cty hwy #> #> 1 1999 4 49 14.2 18.8 #> 2 1999 f 57 20.0 27.9 #> 3 1999 r 11 14 20.6 #> 4 2008 4 54 14.4 19.5 #> 5 2008 f 49 20.0 28.4 #> 6 2008 r 14 14.1 21.3 #> 7 all years 4 103 14.3 19.2 #> 8 all years f 106 20.0 28.2 #> 9 all years r 25 14.1 21 ggplot2::mpg %>% group_with_total(year, drv, .totals_for = drv) %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> `summarise()` has grouped output by 'year'. You can override using the #> `.groups` argument. #> # A tibble: 8 × 5 #> # Groups: year [2] #> year drv n cty hwy #> #> 1 1999 4 49 14.2 18.8 #> 2 1999 f 57 20.0 27.9 #> 3 1999 r 11 14 20.6 #> 4 1999 Total 117 17.0 23.4 #> 5 2008 4 54 14.4 19.5 #> 6 2008 f 49 20.0 28.4 #> 7 2008 r 14 14.1 21.3 #> 8 2008 Total 117 16.7 23.5"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":null,"dir":"Reference","previous_headings":"","what":"CHS holidays over a 20-year period — holidays_chestnut","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"dataset containing dates Chestnut Health System holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"","code":"holidays_chestnut"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"tibble 140 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":null,"dir":"Reference","previous_headings":"","what":"Illinois state holidays over a 20-year period — holidays_il","title":"Illinois state holidays over a 20-year period — holidays_il","text":"dataset containing dates State Illinois holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Illinois state holidays over a 20-year period — holidays_il","text":"","code":"holidays_il"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Illinois state holidays over a 20-year period — holidays_il","text":"tibble 252 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":null,"dir":"Reference","previous_headings":"","what":"US federal holidays over a 20-year period — holidays_us","title":"US federal holidays over a 20-year period — holidays_us","text":"dataset containing dates United States federal holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US federal holidays over a 20-year period — holidays_us","text":"","code":"holidays_us"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US federal holidays over a 20-year period — holidays_us","text":"tibble 212 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"US federal holidays over a 20-year period — holidays_us","text":"https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":null,"dir":"Reference","previous_headings":"","what":"Open dataframe in Excel — in_excel","title":"Open dataframe in Excel — in_excel","text":"Saves dataframe .csv R temp directory, opens Excel. .csv randomly-generated name unless otherwise specified name.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open dataframe in Excel — in_excel","text":"","code":"in_excel(df, name, na = \"\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open dataframe in Excel — in_excel","text":"df dataframe open Excel. name (Optional) name use .csv file. provided, random name generated. na (Optional) string use missing values .csv file. Defaults empty string.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":null,"dir":"Reference","previous_headings":"","what":"Vectorized logical tests — is_TRUE","title":"Vectorized logical tests — is_TRUE","text":"is_TRUE() is_FALSE() vectorized versions base::isTRUE() base::isFALSE(), respectively. is_TRUE() returns TRUE vector element evaluates TRUE, FALSE elements (including NAs non-logical values). Useful handling NAs logical tests.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vectorized logical tests — is_TRUE","text":"","code":"is_TRUE(x, strict = TRUE) is_FALSE(x, strict = TRUE) is_TRUE_or_NA(x, strict = TRUE) is_FALSE_or_NA(x, strict = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vectorized logical tests — is_TRUE","text":"x Vector tested strict TRUE (default), numeric character types always return FALSE. FALSE, numeric character vectors can coerced logical (e.g., 1, \"FALSE\") coerced testing.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":null,"dir":"Reference","previous_headings":"","what":"Test for data encoded as other formats — is_coercible_numeric","title":"Test for data encoded as other formats — is_coercible_numeric","text":"Tests whether element vector can coerced another type. See examples.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test for data encoded as other formats — is_coercible_numeric","text":"","code":"is_coercible_numeric(x, all = FALSE, na = c(\"NA\", \"TRUE\")) is_coercible_integer(x, all = FALSE, na = c(\"NA\", \"TRUE\")) is_coercible_logical( x, all = FALSE, na = c(\"NA\", \"TRUE\"), numeric = c(\"binary\", \"any\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test for data encoded as other formats — is_coercible_numeric","text":"x Vector tested TRUE, returns single logical indicating whether every element x coercible. FALSE (default), returns logical vector length x testing element x. na NA values test NA (default) TRUE? numeric is_coercible_logical, numeric value test TRUE, 0 1 (default)?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test for data encoded as other formats — is_coercible_numeric","text":"","code":"x <- c(\"1\", \"-1.23\", \"$1,234\", NA) is_coercible_numeric(x) #> [1] TRUE TRUE FALSE NA is_coercible_numeric(x, na = \"TRUE\") #> [1] TRUE TRUE FALSE TRUE is_coercible_numeric(x, all = TRUE) #> [1] FALSE is_coercible_integer(x) #> [1] TRUE FALSE FALSE NA y <- c(\"TRUE\", \"T\", \"F\", \"YES\", \"NA\", NA) is_coercible_logical(y) #> [1] TRUE TRUE TRUE FALSE FALSE NA z <- c(0, 1, 2, .1, -1) is_coercible_logical(z) #> [1] TRUE TRUE FALSE FALSE FALSE is_coercible_logical(z, numeric = \"any\") #> [1] TRUE TRUE TRUE TRUE TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify duplicates within a vector or vectors — is_duplicate","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"function checks duplicated values within vector set vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"","code":"is_duplicate(..., nmax = 1, incomparables = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"... one vectors equal length. nmax maximum number times value can appear considered duplicate. incomparables missing values (including NaN) considered duplicates?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"logical vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"","code":"x <- c(1, 2, 2, 3, 3, 3) y <- c(1, 1, 2, 1, 2, 2) is_duplicate(x) #> [1] FALSE TRUE TRUE TRUE TRUE TRUE is_duplicate(x, nmax = 2) #> [1] FALSE FALSE FALSE TRUE TRUE TRUE is_duplicate(x, y) #> [1] FALSE FALSE FALSE FALSE TRUE TRUE z <- c(1, NA, NA) is_duplicate(z) #> [1] FALSE FALSE FALSE is_duplicate(z, incomparables = TRUE) #> [1] FALSE TRUE TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether a data frame contains SPSS variable or value labels — is_spss","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"Checks data frame contains SPSS / haven variable labels, value labels, format attributes.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"","code":"is_spss(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":".data data frame.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"TRUE data frame contains SPSS labels, FALSE otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify non-missing values — is_valid","title":"Identify non-missing values — is_valid","text":"wrapper around !.na(x).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify non-missing values — is_valid","text":"","code":"is_valid(x) is.valid(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":null,"dir":"Reference","previous_headings":"","what":"Median value as double - DEPRECATED — median_dbl","title":"Median value as double - DEPRECATED — median_dbl","text":"Deprecated lighthouse 0.7.0. main use case function avoid type errors dplyr::if_else() case_when(), longer necessary changes introduced dplyr v1.1.0. Returns median x double vector. Alternative stats::median() consistent return value needed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Median value as double - DEPRECATED — median_dbl","text":"","code":"median_dbl(x, na.rm = FALSE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Median value as double - DEPRECATED — median_dbl","text":"","code":"if (FALSE) { # \\dontrun{ # stats::median raises error because of inconsistent return types ### note this no longer raises an error with dplyr >= 1.1.0 dplyr::if_else(c(TRUE, FALSE), median(1:4), median(1:5)) # Error in `dplyr::if_else()`: # ! `false` must be a double vector, not an integer vector. # dplyr::if_else(c(TRUE, FALSE), median_dbl(1:4), median_dbl(1:5)) # 2.5 3.0 } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/n_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Count non-missing cases — n_valid","title":"Count non-missing cases — n_valid","text":"n_valid() returns number vector elements NA. returns percentage non-NA values = \"pct\", tibble containing number percentage = \"n_pct\". pct_valid() wrapper around n_valid(= \"pct\"). n_pct_valid() wrapper around n_pct_valid(= \"n_pct\").","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/n_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count non-missing cases — n_valid","text":"","code":"n_valid(x, out = c(\"n\", \"pct\", \"n_pct\"), ...) pct_valid(x, ...) n_pct_valid(x, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Set NA values based on range of numbers. — na_if_range","title":"Set NA values based on range of numbers. — na_if_range","text":"Changes values range range_min range_max NA. Works numeric vectors well numbers character vectors, factor labels, numeric character vectors classes labelled haven_labelled.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set NA values based on range of numbers. — na_if_range","text":"","code":"na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'numeric' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'character' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'factor' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'labelled' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'haven_labelled' na_if_range(x, range_min = -Inf, range_max = -1) coerce_na_range(x, range_min = -Inf, range_max = -1)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set NA values based on range of numbers. — na_if_range","text":"x numeric vector, character vector, factor. range_min minimum value set NA. Defaults -Inf. range_max maximum value set NA. Defaults -1.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set NA values based on range of numbers. — na_if_range","text":"Previously known coerce_na_range, retained alias backward compatibility.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_like.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate NA values of appropriate type - DEPRECATED — na_like","title":"Generate NA values of appropriate type - DEPRECATED — na_like","text":"function deprecated lighthouse 0.7.0 (1) always buggy (2) main purpose pass appropriate NAs dplyr::if_else() case_when(), longer necessary changes introduced dplyr v1.1.0 Returns compatible NA based x. usually type x (e.g., NA_real_ x double vector). x factor, return NA_character_ factor_as_character = TRUE (default) NA_integer_ otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_like.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate NA values of appropriate type - DEPRECATED — na_like","text":"","code":"na_like(x, factor_as_character = TRUE, match_length = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_to_null.html","id":null,"dir":"Reference","previous_headings":"","what":"Replace NA with NULL and vice versa — na_to_null","title":"Replace NA with NULL and vice versa — na_to_null","text":"na_to_null() Replaces NAs vector list NULL. Can useful lists function arguments (e.g., using purrr::pmap()). null_to_na() Replaces NULLs list NAs. Returns atomic vector unlist = TRUE list otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_to_null.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replace NA with NULL and vice versa — na_to_null","text":"","code":"na_to_null(x) null_to_na(x, unlist = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":null,"dir":"Reference","previous_headings":"","what":"Match values not in vector — not-in","title":"Match values not in vector — not-in","text":"Infix operator returning TRUE elements left operand (lhs) found right operand (rhs). Equivalent !(lhs %% rhs).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match values not in vector — not-in","text":"","code":"lhs %!in% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match values not in vector — not-in","text":"","code":"\"April\" %!in% month.name #> [1] FALSE \"Junvember\" %!in% month.name #> [1] TRUE some_letters <- sample(letters, 10) letters[letters %in% some_letters] #> [1] \"c\" \"d\" \"e\" \"k\" \"n\" \"o\" \"q\" \"t\" \"v\" \"y\" letters[letters %!in% some_letters] #> [1] \"a\" \"b\" \"f\" \"g\" \"h\" \"i\" \"j\" \"l\" \"m\" \"p\" \"r\" \"s\" \"u\" \"w\" \"x\" \"z\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the nth, first, or last non-NA value in a vector — nth_valid","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"functions retrieve nth, first last non-NA value vector. fewer n non-NA values, default value can returned.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"","code":"nth_valid(x, n, default = NA) first_valid(x, default = NA) last_valid(x, default = NA)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"x vector. n integer. Position non-NA value return. Negative values start end vector. default default value use fewer n non-NA values x. cast type x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"nth_valid: nth non-NA value x. first_valid: first non-NA value x. last_valid: last non-NA value x.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"","code":"x <- c(NA, 7, NA, 5, 4, NA, 2, NA) first_valid(x) #> [1] 7 last_valid(x) #> [1] 2 nth_valid(x, 2) #> [1] 5 nth_valid(x, -2) #> [1] 4 nth_valid(x, 6) #> [1] NA nth_valid(x, 6, default = -Inf) #> [1] -Inf"},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate colors before and after alpha blending — opacity","title":"Translate colors before and after alpha blending — opacity","text":"functions translate colors original RGB values RGB values alpha blending background color. before_opacity calculates original color given blended color, after_opacity calculates blended color given original color.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate colors before and after alpha blending — opacity","text":"","code":"after_opacity(color, alpha, bg = \"white\") before_opacity(color, alpha, bg = \"white\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate colors before and after alpha blending — opacity","text":"color starting color color name, hex code, RGB triplet. alpha opacity foreground color, number 0 1. bg background color blending, color name, hex code, RGB triplet. Defaults \"white\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate colors before and after alpha blending — opacity","text":"before_opacity: original color alpha blending, hex code. after_opacity: blended color alpha blending, hex code.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate colors before and after alpha blending — opacity","text":"","code":"red <- \"red\" red_50 <- after_opacity(red, 0.5) red_back <- before_opacity(red_50, 0.5) scales::show_col(c(red, red_50, red_back), ncol = 3) color_blends <- sapply( c(\"red\", \"blue\", \"yellow\", \"white\", \"black\", \"gray50\"), after_opacity, color = \"red\", alpha = 0.5 ) scales::show_col(color_blends)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Open a file or directory — open_file","title":"Open a file or directory — open_file","text":"Functions open file default program open file's location file explorer.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open a file or directory — open_file","text":"","code":"open_file(path) open_location(path) file.open(path) dir.open(path)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open a file or directory — open_file","text":"path path file directory.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Open a file or directory — open_file","text":"file.open() dir.open() aliases, line base::file.create, file.exists, dir.create, dir.exists, etc.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Open a file or directory — open_file","text":"open_file(): Opens file specified path using default program file type. Automatically handles paths special characters. open_location(): Opens file explorer location specified file, file selected possible. Automatically handles paths special characters.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open a file or directory — open_file","text":"","code":"if (FALSE) { # \\dontrun{ # Open a file open_file(\"path/to/file.txt\") # Open a file's location open_location(\"path/to/file.txt\") } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert between probabilities and odds ratios — p_to_OR","title":"Convert between probabilities and odds ratios — p_to_OR","text":"functions convert probabilities odds ratios. p_to_OR calculates odds ratio given two probabilities, OR_to_p2 OR_to_p1 calculate second first probability, respectively, given probability odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert between probabilities and odds ratios — p_to_OR","text":"","code":"p_to_OR(p1, p2) OR_to_p2(p1, OR) OR_to_p1(p2, OR)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert between probabilities and odds ratios — p_to_OR","text":"p1 first probability. p2 second probability. odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert between probabilities and odds ratios — p_to_OR","text":"p_to_OR: odds ratio corresponding given probabilities. OR_to_p2: second probability corresponding given first probability odds ratio. OR_to_p1: first probability corresponding given second probability odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert between probabilities and odds ratios — p_to_OR","text":"","code":"p_to_OR(0.4, 0.6) #> [1] 2.25 OR_to_p2(0.4, 2.25) #> [1] 0.6 OR_to_p1(0.6, 2.25) #> [1] 0.4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":null,"dir":"Reference","previous_headings":"","what":"Pad vectors to the same length — pad_vectors","title":"Pad vectors to the same length — pad_vectors","text":"function takes one vectors pads NA values length longest vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pad vectors to the same length — pad_vectors","text":"","code":"pad_vectors(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pad vectors to the same length — pad_vectors","text":"... One vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pad vectors to the same length — pad_vectors","text":"list vectors, length longest input vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pad vectors to the same length — pad_vectors","text":"","code":"pad_vectors(1:3, 1:5, 1:4) #> [[1]] #> [1] 1 2 3 NA NA #> #> [[2]] #> [1] 1 2 3 4 5 #> #> [[3]] #> [1] 1 2 3 4 NA #> # supports list unpacking with `!!!` operator pad_vectors(!!!list(1:3, 1:5, 1:4)) #> [[1]] #> [1] 1 2 3 NA NA #> #> [[2]] #> [1] 1 2 3 4 5 #> #> [[3]] #> [1] 1 2 3 4 NA #> # one use case is assembling vectors of different lengths into a dataframe # for example, to see unique column values at a glance: unique_vals <- dplyr::starwars %>% dplyr::select(hair_color:eye_color) %>% lapply(unique) pad_vectors(!!!unique_vals) %>% as.data.frame() #> hair_color skin_color eye_color #> 1 blond fair blue #> 2 gold yellow #> 3 none white, blue red #> 4 brown white brown #> 5 brown, grey light blue-gray #> 6 black white, red black #> 7 auburn, white unknown orange #> 8 auburn, grey green hazel #> 9 white green-tan, brown pink #> 10 grey pale unknown #> 11 auburn metal red, blue #> 12 blonde dark gold #> 13 brown mottle green, yellow #> 14 brown white #> 15 grey dark #> 16 mottled green #> 17 orange #> 18 blue, grey #> 19 grey, red #> 20 red #> 21 blue #> 22 grey, blue #> 23 grey, green, yellow #> 24 yellow #> 25 tan #> 26 fair, green, yellow #> 27 silver, red #> 28 green, grey #> 29 red, blue, white #> 30 brown, white #> 31 none "},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":null,"dir":"Reference","previous_headings":"","what":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"Note 2024, pivot_wider_alt()'s functionality now supported tidyr::pivot_wider(). particular, functionality names_value_first = TRUE pivot_wider_alt() can now achieved using names_vary = \"slowest\" pivot_wider(). functionality names_value_sep can achieved using names_glue argument pivot_wider(). wrapper around tidyr::pivot_wider() additional options sorting naming output columns, arguments sort_by_col, names_value_first, names_value_sep options relevant one input column passed values_from.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"","code":"pivot_wider_alt( data, id_cols = NULL, names_from = name, sort_by_col = TRUE, names_value_first = TRUE, names_value_sep = \".\", names_sep = \"_\", names_prefix = \"\", names_glue = NULL, names_repair = \"check_unique\", values_from = value, values_fill = NULL, values_fn = NULL )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"data data frame pivot. id_cols set columns uniquely identify observation. Typically used redundant variables, .e. variables whose values perfectly correlated existing variables. Defaults columns data except columns specified names_from values_from. tidyselect expression supplied, evaluated data removing columns specified names_from values_from. sort_by_col TRUE (default), output columns sorted names_from, values_from. (Differs tidyr::pivot_wider(), sorts values_from first, names_from.) names_value_first FALSE, output columns named using {column}_{.value} scheme. (Differs tidyr::pivot_wider(), uses {.value}_{column} scheme.) names_value_sep, names_sep names_from values_from contain multiple variables, used join values together single string use column name. names_value_sep separate {.value} {column} components, names_sep separate {column} components one another names_from contains multiple variables. See Details Examples. names_prefix, names_glue, names_repair, values_from, values_fill, values_fn See documentation tidyr::pivot_wider().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"#' names_value_sep argument allows output column names use different separator {.value} {column} multiple {columns}s. Example:","code":"pivot_wider_alt( fakedata, names_from = c(size, color), # size = \"sm\", \"med\", \"lg\"; color = \"red\", \"blue\" values_from = c(n, weight), names_sep = \"_\", names_value_sep = \": \" ) # output column names: # `n: sm_red`, `weight: sm_red`, `n: sm_blue`, `weight: sm_blue`, `n: med_red`..."},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"","code":"data_ex <- ggplot2::diamonds %>% dplyr::group_by(cut, color) %>% dplyr::summarize(Min = min(price), Median = median(price), Max = max(price)) #> `summarise()` has grouped output by 'cut'. You can override using the `.groups` #> argument. # default pivot_wider() behavior data_ex %>% tidyr::pivot_wider( id_cols = color, names_from = cut, values_from = Min:Max ) #> # A tibble: 7 × 16 #> color Min_Fair Min_Good `Min_Very Good` Min_Premium Min_Ideal Median_Fair #> #> 1 D 536 361 357 367 367 3730 #> 2 E 337 327 352 326 326 2956 #> 3 F 496 357 357 342 408 3035 #> 4 G 369 394 354 382 361 3057 #> 5 H 659 368 337 368 357 3816 #> 6 I 735 351 336 334 348 3246 #> 7 J 416 335 336 363 340 3302 #> # ℹ 9 more variables: Median_Good , `Median_Very Good` , #> # Median_Premium , Median_Ideal , Max_Fair , Max_Good , #> # `Max_Very Good` , Max_Premium , Max_Ideal # pivot_wider_alt() behavior data_ex %>% pivot_wider_alt( id_cols = color, names_from = cut, values_from = Min:Max ) #> # A tibble: 7 × 16 #> color Min.Fair Median.Fair Max.Fair Min.Good Median.Good Max.Good #> #> 1 D 536 3730 16386 361 2728. 18468 #> 2 E 337 2956 15584 327 2420 18236 #> 3 F 496 3035 17995 357 2647 18686 #> 4 G 369 3057 18574 394 3340 18788 #> 5 H 659 3816 18565 368 3468. 18640 #> 6 I 735 3246 18242 351 3640. 18707 #> 7 J 416 3302 18531 335 3733 18325 #> # ℹ 9 more variables: `Min.Very Good` , `Median.Very Good` , #> # `Max.Very Good` , Min.Premium , Median.Premium , #> # Max.Premium , Min.Ideal , Median.Ideal , Max.Ideal # with `names_value_first` = FALSE data_ex %>% pivot_wider_alt( id_cols = color, names_from = cut, values_from = Min:Max, names_value_first = FALSE ) #> # A tibble: 7 × 16 #> color Fair.Min Fair.Median Fair.Max Good.Min Good.Median Good.Max #> #> 1 D 536 3730 16386 361 2728. 18468 #> 2 E 337 2956 15584 327 2420 18236 #> 3 F 496 3035 17995 357 2647 18686 #> 4 G 369 3057 18574 394 3340 18788 #> 5 H 659 3816 18565 368 3468. 18640 #> 6 I 735 3246 18242 351 3640. 18707 #> 7 J 416 3302 18531 335 3733 18325 #> # ℹ 9 more variables: `Very Good.Min` , `Very Good.Median` , #> # `Very Good.Max` , Premium.Min , Premium.Median , #> # Premium.Max , Ideal.Min , Ideal.Median , Ideal.Max # multiple `names_from` vars, with different value vs. name separators ggplot2::mpg %>% dplyr::filter(class %in% c(\"compact\", \"subcompact\", \"midsize\")) %>% dplyr::group_by( manufacturer, trans = stringr::str_extract(trans, \".*(?=\\\\()\"), year ) %>% dplyr::summarize(across(c(cty, hwy), mean)) %>% pivot_wider_alt( names_from = trans:year, values_from = cty:hwy, names_sep = \"_\", names_value_sep = \": \" ) #> `summarise()` has grouped output by 'manufacturer', 'trans'. You can override #> using the `.groups` argument. #> # A tibble: 10 × 9 #> # Groups: manufacturer [10] #> manufacturer `cty: auto_1999` `hwy: auto_1999` `cty: auto_2008` #> #> 1 audi 16 25.8 18 #> 2 chevrolet 18.5 26.5 19 #> 3 ford 16.5 23 15.5 #> 4 honda 24 32 24.5 #> 5 hyundai 18.3 26 19.2 #> 6 nissan 18.5 26.5 20.3 #> 7 pontiac 17 26.3 17 #> 8 subaru 20 26 20 #> 9 toyota 21 28.2 21.2 #> 10 volkswagen 19.4 28.1 20.2 #> # ℹ 5 more variables: `hwy: auto_2008` , `cty: manual_1999` , #> # `hwy: manual_1999` , `cty: manual_2008` , #> # `hwy: manual_2008` "},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":null,"dir":"Reference","previous_headings":"","what":"tidyselect-friendly parallel minima and maxima — pminmax_across","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"Wrappers around base::pmin() base::pmax() accept expressions.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"","code":"pmax_across(cols, na.rm = FALSE) pmin_across(cols, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"","code":"# using `base::pmax()` mtcars %>% dplyr::mutate( max_val = pmax(mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb) ) #> mpg cyl disp hp drat wt qsec vs am gear carb max_val #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 160.0 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 160.0 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 108.0 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 258.0 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 360.0 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 225.0 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 360.0 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 146.7 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 140.8 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 167.6 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 167.6 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 275.8 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 275.8 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 275.8 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 472.0 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 460.0 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 440.0 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 78.7 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 75.7 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 71.1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 120.1 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 318.0 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 304.0 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 350.0 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 400.0 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 79.0 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 120.3 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 113.0 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 351.0 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 175.0 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 335.0 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 121.0 # using `pmax_across()` mtcars %>% dplyr::mutate(max_val = pmax_across(mpg:carb)) #> mpg cyl disp hp drat wt qsec vs am gear carb max_val #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 160.0 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 160.0 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 108.0 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 258.0 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 360.0 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 225.0 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 360.0 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 146.7 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 140.8 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 167.6 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 167.6 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 275.8 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 275.8 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 275.8 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 472.0 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 460.0 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 440.0 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 78.7 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 75.7 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 71.1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 120.1 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 318.0 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 304.0 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 350.0 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 400.0 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 79.0 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 120.3 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 113.0 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 351.0 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 175.0 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 335.0 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 121.0"},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_all.html","id":null,"dir":"Reference","previous_headings":"","what":"Print all tibble rows — print_all","title":"Print all tibble rows — print_all","text":"Actually limits printing RStudioPreference \"console_max_lines\" (1000 lines running RStudio) unless otherwise specified max. Works tibbles, base::data.frames.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_all.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print all tibble rows — print_all","text":"","code":"print_all(x, ..., max = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Print specified number of tibble rows — print_n","title":"Print specified number of tibble rows — print_n","text":"Print specified number tibble rows","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print specified number of tibble rows — print_n","text":"","code":"print_n(x, n, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/rbool.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate random logicals — rbool","title":"Generate random logicals — rbool","text":"Returns vector random logicals length n, drawn binomial distribution trial probability prob (default = .5).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/rbool.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate random logicals — rbool","text":"","code":"rbool(n, prob = 0.5)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. magrittr %>% scales comma, percent","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reorder_dendro_by_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Reorder a dendrogram — reorder_dendro_by_label","title":"Reorder a dendrogram — reorder_dendro_by_label","text":"Reorders dendrogram leaves based vector labels passed .order.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reorder_dendro_by_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reorder a dendrogram — reorder_dendro_by_label","text":"","code":"reorder_dendro_by_label(.dendro, .order, agglo.FUN = max)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/rev_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Reverse the order of rows in a table. — rev_rows","title":"Reverse the order of rows in a table. — rev_rows","text":"Reverse order rows table.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/rev_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reverse the order of rows in a table. — rev_rows","text":"","code":"rev_rows(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Reverse key a numeric vector — reverse_key","title":"Reverse key a numeric vector — reverse_key","text":"Reverses numeric vector x subtracting min adding max. Observed minimum maximum x used unless otherwise specified.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reverse key a numeric vector — reverse_key","text":"","code":"reverse_key(x, na.rm = FALSE, max = NULL, min = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Reverse key a numeric vector — reverse_key","text":"","code":"reverse_key(1:5) #> [1] 5 4 3 2 1 reverse_key(3:5) #> [1] 5 4 3 reverse_key(3:5, min = 1, max = 5) #> [1] 3 2 1"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":null,"dir":"Reference","previous_headings":"","what":"Row sums for selected columns with NA handling — row_sums_across","title":"Row sums for selected columns with NA handling — row_sums_across","text":"function calculates row sums selected columns using tidyselect expressions. Unlike rowSums, returns NA rather 0 na.rm = TRUE selected columns NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Row sums for selected columns with NA handling — row_sums_across","text":"","code":"row_sums_across(cols, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Row sums for selected columns with NA handling — row_sums_across","text":"cols columns sum across. na.rm missing values (including NaN) removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Row sums for selected columns with NA handling — row_sums_across","text":"","code":"df <- tibble::tibble( x = c(1, 2, NA, NA), y = c(5, NA, 7, NA), z = c(9, 10, 11, NA) ) df %>% dplyr::mutate( row_sums = row_sums_across(x:z), row_sums_na.rm = row_sums_across(x:z, na.rm = TRUE) ) #> # A tibble: 4 × 5 #> x y z row_sums row_sums_na.rm #> #> 1 1 5 9 15 15 #> 2 2 NA 10 NA 12 #> 3 NA 7 11 NA 18 #> 4 NA NA NA NA NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_spss.html","id":null,"dir":"Reference","previous_headings":"","what":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","title":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","text":"Deprecated lighthouse 0.7.0 favor row_sums_across(), provides information features stable. Sums across columns la SPSS: NAs counted 0s, variables NA, result NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_spss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","text":"","code":"row_sums_spss(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/safe_minmax.html","id":null,"dir":"Reference","previous_headings":"","what":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","title":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","text":"Deprecated lighthouse 0.7.0 favor max_if_any() min_if_any(), now call.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/safe_minmax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","text":"","code":"safe_max(..., na.rm = TRUE) safe_min(..., na.rm = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_mad.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale based on median absolute deviation — scale_mad","title":"Scale based on median absolute deviation — scale_mad","text":"Scales vector values based median absolute deviation. Values may centered around median (default), mean, centered. Compare base::scale(), uses standard deviation centers around mean default.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_mad.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale based on median absolute deviation — scale_mad","text":"","code":"scale_mad(x, center = c(\"median\", \"mean\", \"none\"), mad_constant = 1.4826)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":null,"dir":"Reference","previous_headings":"","what":"Scaling and centering of vectors — scale_vec","title":"Scaling and centering of vectors — scale_vec","text":"wrapper around base::scale() returns vector instead matrix.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scaling and centering of vectors — scale_vec","text":"","code":"scale_vec(x, center = TRUE, scale = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scaling and centering of vectors — scale_vec","text":"","code":"# using base::scale() scale(0:4) #> [,1] #> [1,] -1.2649111 #> [2,] -0.6324555 #> [3,] 0.0000000 #> [4,] 0.6324555 #> [5,] 1.2649111 #> attr(,\"scaled:center\") #> [1] 2 #> attr(,\"scaled:scale\") #> [1] 1.581139 # using scale_vec() scale_vec(0:4) #> [1] -1.2649111 -0.6324555 0.0000000 0.6324555 1.2649111"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error - DEPRECATED — se","title":"Compute the standard error - DEPRECATED — se","text":"Deprecated 0.7.0 favor specific functions se_mean() se_mean(). se() now calls se_mean() deprecation warning. Computes standard error values x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error - DEPRECATED — se","text":"","code":"se(x, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error - DEPRECATED — se","text":"x numeric vector non-factor object coercible numeric .double(x). na.rm logical. missing values removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error of the mean — se_mean","title":"Compute the standard error of the mean — se_mean","text":"Computes standard error mean numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error of the mean — se_mean","text":"","code":"se_mean(x, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error of the mean — se_mean","text":"x numeric vector non-factor object coercible numeric .double(x). na.rm logical. missing values removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error of a proportion — se_prop","title":"Compute the standard error of a proportion — se_prop","text":"Computes standard error proportion logical numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error of a proportion — se_prop","text":"","code":"se_prop( x, na.rm = FALSE, min_var = 5, low_var_action = c(\"warn\", \"ignore\", \"error\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error of a proportion — se_prop","text":"x logical numeric vector. numeric, must include 0s, 1s, /NAs. na.rm logical. missing values removed? min_var numeric. Minimum variance (n * p * (1 - p) valid normal approximation binomial. See Details. low_var_action character. Action take variance min_var.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the standard error of a proportion — se_prop","text":"Standard error proportion calculated using formula: $$SE = \\sqrt{\\frac{p(1 - p)}{n}}$$ formula assumes binomial sampling distribution underlying observed proportion can approximated normal distribution. assumption valid proportion variance (np(1 - p)) sufficiently large, may hold variance lower. se_prop() therefore issues warning variance less 5; behavior can overridden using min_var low_var_action arguments.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":null,"dir":"Reference","previous_headings":"","what":"Set comparison with automatic naming — set_compare","title":"Set comparison with automatic naming — set_compare","text":"Compares two sets (vectors), returning elements unique elements common. Optionally names returned sets based supplied object names.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set comparison with automatic naming — set_compare","text":"","code":"set_compare(x, y, autoname = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set comparison with automatic naming — set_compare","text":"x vector representing first set. y vector representing second set. autoname Logical, whether automatically name returned sets based supplied object names. Defaults TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set comparison with automatic naming — set_compare","text":"named list three elements: Elements unique x Elements unique y Elements common x y","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set comparison with automatic naming — set_compare","text":"","code":"v1 <- c(1, 2, 3, 4) v2 <- c(3, 4, 5, 6) set_compare(v1, v2) #> $v1 #> [1] 1 2 #> #> $v2 #> [1] 5 6 #> #> $intersect #> [1] 3 4 #> set_compare(v1, v2, autoname = FALSE) #> $x #> [1] 1 2 #> #> $y #> [1] 5 6 #> #> $intersect #> [1] 3 4 #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"Changes default theme color scales ggplot2.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"","code":"set_ggplot_opts(base_theme = NULL, brewer_pal_discrete = \"Set1\", ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"Theme based hrbrthemes::theme_ipsum_rc(), unless otherwise specified base_theme argument. theme modified follows: Axis titles centered Legend title omitted Minor gridlines omitted Facet labels placed outside axes Various tweaks text size margins Default color fill palettes set based scale type: discrete scales, RColorBrewer palette \"Set1,\" unless otherwise specified brewer_pal_discrete argument continuous binned scales, RColorBrewer palette \"Blues\" ordinal scales, viridisLite palette \"viridis\" Default font family geom_text() geom_label() set match base_theme.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":null,"dir":"Reference","previous_headings":"","what":"Concatenate strings with NA handling — str_c_narm","title":"Concatenate strings with NA handling — str_c_narm","text":"str_c_narm concatenates strings similar base::paste() stringr::str_c(), different NA handling. NAs dropped row-wise prior concatenation. See Details Examples.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Concatenate strings with NA handling — str_c_narm","text":"","code":"str_c_narm( ..., sep = \"\", collapse = NULL, if_all_na = c(\"empty\", \"NA\", \"remove\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Concatenate strings with NA handling — str_c_narm","text":"... character vectors vectors coercible character. May also single data frame (accommodate dplyr::across() pick()). sep separator insert input vectors. collapse optional character string combine results single string. if_all_na values row NA: \"empty\": (default) returns empty string. \"NA\": returns NA. \"remove\": removes row output.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Concatenate strings with NA handling — str_c_narm","text":"character vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Concatenate strings with NA handling — str_c_narm","text":"str_c_narm() provides alternative missing value handling compared base::paste() stringr::str_c(). Given vectors missing values: paste() paste0() convert NAs string \"NA\" concatenating: ...stringr::str_c returns NA value row NA: contrast, str_c_narm() removes NAs row concatenating: ...options case values row NA:","code":"#> (dat <- tibble::tibble(v1 = c(\"a1\", \"b1\", \"c1\", NA), v2 = c(\"a2\", NA, \"c2\", NA), v3 = c(\"a3\", \"b3\", NA, NA))) # A tibble: 4 × 3 v1 v2 v3 1 a1 a2 a3 2 b1 NA b3 3 c1 c2 NA 4 NA NA NA #> dplyr::mutate(dat, paste = paste(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 paste 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 b1 | NA | b3 3 c1 c2 NA c1 | c2 | NA 4 NA NA NA NA | NA | NA #> dplyr::mutate(dat, str_c = stringr::str_c(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 str_c 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 NA 3 c1 c2 NA NA 4 NA NA NA NA #> dplyr::mutate(dat, str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 str_c_narm 1 a1 a2 a3 \"a1 | a2 | a3\" 2 b1 NA b3 \"b1 | b3\" 3 c1 c2 NA \"c1 | c2\" 4 NA NA NA \"\" #> dplyr::mutate(dat, str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \", if_all_na = \"NA\")) # A tibble: 4 × 4 v1 v2 v3 str_c_narm 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 b1 | b3 3 c1 c2 NA c1 | c2 4 NA NA NA NA"},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Concatenate strings with NA handling — str_c_narm","text":"","code":"str_c_narm(c(\"a\", NA), c(\"b\", \"c\"), sep = \"_\") #> [1] \"a_b\" \"c\" str_c_narm(c(\"a\", NA), c(\"b\", NA), if_all_na = \"NA\") #> [1] \"ab\" NA # compare behavior to `paste()` and `str_c()` dat <- tibble::tibble(v1 = c(\"a1\", \"b1\", \"c1\", NA), v2 = c(\"a2\", NA, \"c2\", NA), v3 = c(\"a3\", \"b3\", NA, NA)) dplyr::mutate( dat, paste = paste(v1, v2, v3, sep = \" | \"), str_c = stringr::str_c(v1, v2, v3, sep = \" | \"), str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \") ) #> # A tibble: 4 × 6 #> v1 v2 v3 paste str_c str_c_narm #> #> 1 a1 a2 a3 a1 | a2 | a3 a1 | a2 | a3 \"a1 | a2 | a3\" #> 2 b1 NA b3 b1 | NA | b3 NA \"b1 | b3\" #> 3 c1 c2 NA c1 | c2 | NA NA \"c1 | c2\" #> 4 NA NA NA NA | NA | NA NA \"\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy string concatenation — str_c_tidy","title":"Tidy string concatenation — str_c_tidy","text":"function performs tidyverse-friendly string concatenation. takes data frame tibble selection columns, concatenates string values row, returns concatenated strings vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy string concatenation — str_c_tidy","text":"","code":"str_c_tidy( ..., sep = \"\", collapse = NULL, na.rm = FALSE, if_all_na = c(\"empty\", \"NA\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy string concatenation — str_c_tidy","text":"... tidyselect expression indicating character columns vectors columns coercible character. sep separator insert input vectors. collapse optional character string combine results single string. na.rm logical. Remove missing values concatenating? Treatment NAs similar str_c_narm() differs behavior paste() stringr::str_c(). See Details str_c_narm(). if_all_na na.rm = TRUE values row NA. \"empty\", default, returns empty string. \"NA\" returns NA. Ignored na.rm = FALSE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy string concatenation — str_c_tidy","text":"character vector.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy string concatenation — str_c_tidy","text":"","code":"df <- tibble::tribble( ~x, ~y, ~z, \"a\", \"b\", \"c\", \"d\", NA, \"f\", \"g\", \"h\", NA ) df %>% dplyr::mutate(combined = str_c_tidy(x:z)) #> # A tibble: 3 × 4 #> x y z combined #> #> 1 a b c abc #> 2 d NA f NA #> 3 g h NA NA df %>% dplyr::mutate(combined = str_c_tidy(x:z, na.rm = TRUE)) #> # A tibble: 3 × 4 #> x y z combined #> #> 1 a b c abc #> 2 d NA f df #> 3 g h NA gh"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse a character vector into a single string — str_collapse","title":"Collapse a character vector into a single string — str_collapse","text":"Concatenates elements character vector. Essentially column-wise variant dplyr::str_c(). Can accept multiple character vectors, returned separate character strings join = NULL (default), concatenated separator supplied join.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse a character vector into a single string — str_collapse","text":"","code":"str_collapse(..., sep = \"\", join = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse a character vector into a single string — str_collapse","text":"... one character vectors sep string insert elements input vector join optional string combine output single string. join multiple collapsed vectors. NULL (default), returns character vector input vector collapsed separately.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse a character vector into a single string — str_collapse","text":"join NULL, returns character vector length equal number vectors passed .... join provided, returns character vector length 1.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Collapse a character vector into a single string — str_collapse","text":"single character vector passed ..., behavior similar stringr::str_c() using collapse argument. behavior differs multiple vectors passed ... – see examples. difference arise str_collapse() first collapses vector, optionally joins resulting vectors, whereas stringr::str_c() first joins across vectors collapsing resulting vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse a character vector into a single string — str_collapse","text":"","code":"# with just a single character vector, behavior is similar to `stringr::str_c()` # with the `collapse` argument abc <- c(\"a\", \"b\", \"c\") str_collapse(abc, sep = \"-\") #> [1] \"a-b-c\" stringr::str_c(abc, collapse = \"-\") #> [1] \"a-b-c\" # but behavior differs when multiple vectors are passed def <- c(\"d\", \"e\", \"f\") str_collapse(abc, def, sep = \"-\") #> [1] \"a-b-c\" \"d-e-f\" stringr::str_c(abc, def, collapse = \"-\") #> [1] \"ad-be-cf\" str_collapse(abc, def, sep = \"-\", join = \" | \") #> [1] \"a-b-c | d-e-f\" stringr::str_c(abc, def, collapse = \"-\", sep = \" | \") #> [1] \"a | d-b | e-c | f\" stringr::str_c(abc, def, sep = \"-\", collapse = \" | \") #> [1] \"a-d | b-e | c-f\" # can accept vectors of different lengths lmnop <- c(\"l\", \"m\", \"n\", \"o\", \"p\") str_collapse(abc, def, lmnop, join = \", \") #> [1] \"abc, def, lmnop\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Detect the presence of any pattern in a string — str_detect_any","title":"Detect the presence of any pattern in a string — str_detect_any","text":"str_detect_any() returns TRUE element patterns present string. str_starts_any() str_ends_any() match beginning end strings.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Detect the presence of any pattern in a string — str_detect_any","text":"","code":"str_detect_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE ) str_starts_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE ) str_ends_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Detect the presence of any pattern in a string — str_detect_any","text":"string character vector something coercible one. patterns character vector containing regular expressions look . whole_word logical. Match whole words string (defined \"\\\\b\" word boundary)? ignore_case logical. Ignore case matching patterns string? negate Logical. TRUE, inverts resulting boolean vector.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":null,"dir":"Reference","previous_headings":"","what":"Find common prefixes or suffixes — str_prefix","title":"Find common prefixes or suffixes — str_prefix","text":"Returns substring beginnings endings common elements vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find common prefixes or suffixes — str_prefix","text":"","code":"str_prefix(string, na.rm = FALSE) str_suffix(string, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Find common prefixes or suffixes — str_prefix","text":"","code":"test_words <- c(\"antidote\", \"antimony\", \"antimatter\", \"antisense\") str_prefix(test_words) #> [1] \"anti\" wdays <- c( \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ) str_suffix(wdays) #> [1] \"day\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":null,"dir":"Reference","previous_headings":"","what":"Format date-time to string without leading zeros — strftime_no_lead","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"Converts date-time object character string without leading zeros numeric components. Wraps format.POSIXlt(), removing leading zeros using regex substitution.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"","code":"strftime_no_lead(x, format = \"%m/%d/%Y\", tz = \"\", usetz = FALSE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"x date-time object. format character string giving date-time format used strftime(). tz character string specifying time zone used. usetz logical value indicating whether time zone abbreviation appended output. ... arguments passed format.POSIXlt().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"character vector representing date-time without leading zeros.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"","code":"dt <- as.POSIXct(\"2023-06-05 01:02:03\") # With leading zeros format(dt, \"%m/%d/%Y %H:%M:%S\") #> [1] \"06/05/2023 01:02:03\" # Without leading zeros strftime_no_lead(dt, \"%m/%d/%Y %H:%M:%S\") #> [1] \"6/5/2023 1:2:3\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize variables based on measurement level — summary_report","title":"Summarize variables based on measurement level — summary_report","text":"Summarizes variable passed .... handled differently based variable's level measurement: nominal variables, returns n proportion level binary variables, returns n proportion TRUE continuous variables, returns mean standard deviation default. Specify alternative summary statistics using .cont_fx. default, summary_report() guess measurement level variable. can overridden variables using .default argument, select variables using nom(), bin(), cont() measurement wrappers. See details.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize variables based on measurement level — summary_report","text":"","code":"summary_report( .data, ..., .default = c(\"auto\", \"nom\", \"bin\", \"cont\"), .drop = TRUE, .cont_fx = list(mean, sd), .missing_label = NA, na.rm = FALSE, na.rm.nom = na.rm, na.rm.bin = na.rm, na.rm.cont = na.rm ) nom(...) bin(...) cont(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize variables based on measurement level — summary_report","text":".data data frame data frame extension. ... one variable names. /tidyselect expressions. Elements may wrapped nom(), bin(), cont() force summarizing binary, nominal, continuous, respectively; see details. .default determine measurement level variables specified measurement wrapper. \"auto\" guess measurement level variable, \"nom\", \"bin\", \"cont\" treat unwrapped variables nominal, binary, continuous, respectively. .drop FALSE, frequencies nominal variables include counts empty groups (.e. levels factors exist data). .cont_fx list containing two functions continuous variables summarized. .missing_label label missing values nominal variables. na.rm TRUE, NA values variable dropped prior computation. na.rm.nom, na.rm.bin, na.rm.cont control NA handling specifically nominal, binary, continuous variables. Overrides na.rm variable type.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"determining-measurement-level","dir":"Reference","previous_headings":"","what":"Determining measurement level","title":"Summarize variables based on measurement level — summary_report","text":"measurement level variable determined follows: Variables wrapped nom(), bin(), cont() treated nominal, binary, continuous, respectively. Variables without measurement wrapper treated type specified .default. .default \"auto\", measurement level inferred: Logical vectors treated binary missing values na.rm.bin = TRUE. Character vectors, factors, logical vectors missing values treated nominal. variables treated continuous.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"support-for-binary-variables","dir":"Reference","previous_headings":"","what":"Support for binary variables","title":"Summarize variables based on measurement level — summary_report","text":"treated binary, must true: variable must either logical vector, binary numeric vector containing 0s 1s. variable must include missing values, na.rm.bin must set TRUE. Future extensions may allow handling dichotomous variables (e.g., \"Pregnant\" vs. \"pregnant\"), currently supported. Instead, consider converting logical indicator, e.g., Pregnant = PregnancyStatus == \"Pregnant\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize variables based on measurement level — summary_report","text":"","code":"if (FALSE) { # \\dontrun{ # create a report using pre-processed SOR data total_label <- \"SOR-II Overall\" data_baseline %>% group_with_total(ServiceType, .label = total_label) %>% summary_report( Age, Gender, Race, bin(DAUseAlcohol, DAUseIllegDrugs, DAUseBoth), DAUseAlcoholDays, DAUseIllegDrugsDays, DAUseBothDays, DAUseAlcoholDaysOrdinal, DAUseIllegDrugsDaysOrdinal, DAUseBothDaysOrdinal, na.rm = TRUE, .drop = FALSE ) %>% pivot_wider( names_from = ServiceType, names_vary = \"slowest\", values_from = V1:V2 ) %>% relocate(contains(total_label), .after = Value) %>% add_rows_at_value(Variable, Race, DAUseBoth, DAUseBothDays) %>% print_all() } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom summary table — summary_table","title":"Custom summary table — summary_table","text":"Generates summary table, row variable passed .vars column function passed ....","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom summary table — summary_table","text":"","code":"summary_table( .data, ..., .vars = where(is.numeric), na.rm = FALSE, .rows_group_by = NULL, .cols_group_by = NULL, .cols_group_opts = list(), .var_col_name = \"Variable\" )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom summary table — summary_table","text":".data data frame data frame extension (e.g. tibble). ... Functions apply variable specified .vars, function names (e.g., mean) anonymous functions (e.g., \\(x) mean(x, na.rm = TRUE)). function passed ... yield one column output table (one column per group .cols_group_by specified). Output column names can optionally specified. E.g., m = mean, sd, sem = \\(x) sd(x) / sqrt(n()) yields output columns named m, sd, sem. .vars Columns .data summarize. column passed .vars yield one row output table (one row per group .rows_group_by specified). na.rm logical value passed functions ... take na.rm argument. .rows_group_by Grouping variable(s) output rows. .cols_group_by Grouping variable(s) output columns. .cols_group_opts list additional arguments passed tidyr::pivot_wider() .cols_group_by specified. .var_col_name name output column containing variable names passed .vars. column dropped .var_col_name NULL one variable passed .vars.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom summary table — summary_table","text":"","code":"# example data mtcars2 <- mtcars %>% dplyr::mutate( Transmission = dplyr::recode(am, `0` = \"auto\", `1` = \"manual\") ) # simple summary table. note specification of column and row names # for \"n\", \"m\", and \"weight\". mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = c(mpg, hp, weight = wt) ) #> # A tibble: 3 × 4 #> Variable n m sd #> #> 1 mpg 32 20.1 6.03 #> 2 hp 32 147. 68.6 #> 3 weight 32 3.22 0.978 # with column and row groupings mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = c(mpg, hp, weight = wt), .cols_group_by = cyl, .rows_group_by = Transmission ) #> # A tibble: 6 × 11 #> Transmission Variable n_4 m_4 sd_4 n_6 m_6 sd_6 n_8 m_8 #> #> 1 auto mpg 3 22.9 1.45 4 19.1 1.63 12 15.0 #> 2 auto hp 3 84.7 19.7 4 115. 9.18 12 194. #> 3 auto weight 3 2.94 0.408 4 3.39 0.116 12 4.10 #> 4 manual mpg 8 28.1 4.48 3 20.6 0.751 2 15.4 #> 5 manual hp 8 81.9 22.7 3 132. 37.5 2 300. #> 6 manual weight 8 2.04 0.409 3 2.76 0.128 2 3.37 #> # ℹ 1 more variable: sd_8 # `.var_col_name = NULL` will drop the variable name column if only one # variable is included in `.vars` mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = mpg, .cols_group_by = cyl, .rows_group_by = Transmission, .var_col_name = NULL ) #> # A tibble: 2 × 10 #> Transmission n_4 m_4 sd_4 n_6 m_6 sd_6 n_8 m_8 sd_8 #> #> 1 auto 3 22.9 1.45 4 19.1 1.63 12 15.0 2.77 #> 2 manual 8 28.1 4.48 3 20.6 0.751 2 15.4 0.566 # `.cols_group_opts` are passed as arguments to `pivot_wider()`. # for instance to customize column names with a glue specification: mtcars2 %>% summary_table( M = mean, SD = sd, .vars = c(mpg, hp, weight = wt), .cols_group_by = c(Transmission, cyl), .cols_group_opts = list(names_glue = \"{cyl} cyl {Transmission}: {.value}\") ) #> # A tibble: 3 × 13 #> Variable `4 cyl auto: M` `4 cyl auto: SD` `6 cyl auto: M` `6 cyl auto: SD` #> #> 1 mpg 22.9 1.45 19.1 1.63 #> 2 hp 84.7 19.7 115. 9.18 #> 3 weight 2.94 0.408 3.39 0.116 #> # ℹ 8 more variables: `8 cyl auto: M` , `8 cyl auto: SD` , #> # `4 cyl manual: M` , `4 cyl manual: SD` , `6 cyl manual: M` , #> # `6 cyl manual: SD` , `8 cyl manual: M` , `8 cyl manual: SD` "},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":null,"dir":"Reference","previous_headings":"","what":"Conditionally suppress warnings or messages — suppress_if","title":"Conditionally suppress warnings or messages — suppress_if","text":"Evaluates expression selectively suppressing warnings messages based content.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conditionally suppress warnings or messages — suppress_if","text":"","code":"suppress_warnings_if( expr, msg_contains = \"\", fixed = TRUE, perl = !fixed, ignore.case = FALSE, negate = FALSE, classes = \"warning\" ) suppress_messages_if( expr, msg_contains = \"\", fixed = TRUE, perl = !fixed, ignore.case = FALSE, negate = FALSE, classes = \"message\" )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Conditionally suppress warnings or messages — suppress_if","text":"expr expression evaluate. msg_contains string match message. Defaults empty string (matches messages). fixed logical indicating whether msg_contains matched fixed string.. perl logical indicating whether Perl-compatible regular expressions used msg_contains. ignore.case logical indicating whether case msg_contains ignored. negate logical indicating whether message matching negated (e.g., suppress messages match msg_contains). classes character vector warning message classes suppress.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Conditionally suppress warnings or messages — suppress_if","text":"result evaluating expr, specified warnings messages suppressed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Conditionally suppress warnings or messages — suppress_if","text":"","code":"# Suppress warnings containing specific text suppress_warnings_if(warning(\"This is a warning\"), \"This\") # Suppress messages unless they contain specific text suppress_messages_if( message(\"13 files processed\"), \"\\\\d{2, }\", fixed = FALSE, negate = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":null,"dir":"Reference","previous_headings":"","what":"Swap column values, optionally based on condition — swap","title":"Swap column values, optionally based on condition — swap","text":"swap() swaps values two columns. swap_if() swaps values rows condition met. x y cast common type using vctrs::vec_cast_common().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Swap column values, optionally based on condition — swap","text":"","code":"swap(.data, x, y) swap_if(.data, cond, x, y, missing = c(\"NA\", \"keep\", \"swap\"))"},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Swap column values, optionally based on condition — swap","text":"x column swap y. y column swap x. cond logical vector. missing cond NA. \"NA\" replaces x y NA. \"keep\" keeps values original columns (though cond FALSE). \"swap\" swaps values x y (though cond TRUE).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Swap column values, optionally based on condition — swap","text":"Based Hadley's code dplyr GitHub issue.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":null,"dir":"Reference","previous_headings":"","what":"Print symbols as a character vector — syms_to_chr","title":"Print symbols as a character vector — syms_to_chr","text":"helper converting list symbols character vector. Primarily intended help convert old code given updates summary_report().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print symbols as a character vector — syms_to_chr","text":"","code":"syms_to_chr(..., width = 80, indent = 0, indent_first = indent)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print symbols as a character vector — syms_to_chr","text":"... symbols. width maximum width line output. indent number spaces indent. indent_first number spaces indent first line.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print symbols as a character vector — syms_to_chr","text":"","code":"syms_to_chr( various, very, video, view, village, visit, vote, wage, wait, walk, wall, want, war, warm, wash, waste, watch, water, way, we, wear, wednesday, wee, week, weigh, welcome, well, west, what, when, where, whether, which, white, who, whole, why, wide, wife, will, win, wind, window, wish, with, within, without, woman, wonder, wood, word, work, world, worry, worse, worth, would, write, wrong, year, yes, yesterday, yet, you, young ) #> c(\"various\", \"very\", \"video\", \"view\", \"village\", \"visit\", \"vote\", \"wage\", #> \"wait\", \"walk\", \"wall\", \"want\", \"war\", \"warm\", \"wash\", \"waste\", \"watch\", #> \"water\", \"way\", \"we\", \"wear\", \"wednesday\", \"wee\", \"week\", \"weigh\", \"welcome\", #> \"well\", \"west\", \"what\", \"when\", \"where\", \"whether\", \"which\", \"white\", \"who\", #> \"whole\", \"why\", \"wide\", \"wife\", \"will\", \"win\", \"wind\", \"window\", \"wish\", #> \"with\", \"within\", \"without\", \"woman\", \"wonder\", \"wood\", \"word\", \"work\", #> \"world\", \"worry\", \"worse\", \"worth\", \"would\", \"write\", \"wrong\", \"year\", \"yes\", #> \"yesterday\", \"yet\", \"you\", \"young\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Transpose a tibble — t_tibble","title":"Transpose a tibble — t_tibble","text":"Given tibble data.frame x, returns transpose x. Similar base::t(), accepts returns tibbles, includes options row column name handling.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Transpose a tibble — t_tibble","text":"","code":"t_tibble(x, names_to = \"Variable\", names_from = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Transpose a tibble — t_tibble","text":"x dataframe tibble. names_to Name column transposed tibble containing column names x names_from Column x used column names transposed tibble. specified x rownames, used; otherwise columns named ...1, ...2, etc.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":null,"dir":"Reference","previous_headings":"","what":"US state and territory data — territory","title":"US state and territory data — territory","text":"state.terr.name state.terr.abb expand built-state.name state.abb vectors adding US territories District Columbia. includes: American Samoa District Columbia Guam Northern Mariana Islands Puerto Rico Virgin Islands state.terr.data includes names, abbreviations, FIPS codes US states territories.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US state and territory data — territory","text":"","code":"state.terr.name state.terr.abb state.terr.data"},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US state and territory data — territory","text":"object class character length 56. object class character length 56. object class tbl_df (inherits tbl, data.frame) 56 rows 4 columns.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/try_numeric.html","id":null,"dir":"Reference","previous_headings":"","what":"Suppress NA warning when coercing to numeric — try_numeric","title":"Suppress NA warning when coercing to numeric — try_numeric","text":"Coerces x numeric. x coerced, returns NA suppresses coercion warning.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/try_numeric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Suppress NA warning when coercing to numeric — try_numeric","text":"","code":"try_numeric(x) try.numeric(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":null,"dir":"Reference","previous_headings":"","what":"Unpack and assign — unpack-assign","title":"Unpack and assign — unpack-assign","text":"Assigns vector values equal-length vector names.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Unpack and assign — unpack-assign","text":"","code":"lhs %<-% rhs lhs %->% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Unpack and assign — unpack-assign","text":"%<-% operator left--right variant (%->%) allow parallel assignment, similar (e.g.) Python: See zeallot package similar operator advanced functionality.","code":"# python var1, var2, var3 = [2, 4, 6] # R c(var1, var2, var3) %<-% c(2, 4, 6)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Unpack and assign — unpack-assign","text":"","code":"c(cyl4, cyl6, cyl8) %<-% split(mtcars, mtcars$cyl) cyl4 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 split(mtcars, mtcars$gear) %->% c(G3, G4, G5) G5 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.7 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.5 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.5 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.6 0 1 5 8 c(model_hp, model_size, model_trans) %<-% purrr::map( c(\"hp\", \"disp + wt\", \"gear * am\"), ~ lm(paste(\"mpg ~\", .x), data = mtcars) ) summary(model_size) #> #> Call: #> lm(formula = paste(\"mpg ~\", .x), data = mtcars) #> #> Residuals: #> Min 1Q Median 3Q Max #> -3.4087 -2.3243 -0.7683 1.7721 6.3484 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 34.96055 2.16454 16.151 4.91e-16 *** #> disp -0.01773 0.00919 -1.929 0.06362 . #> wt -3.35082 1.16413 -2.878 0.00743 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 2.917 on 29 degrees of freedom #> Multiple R-squared: 0.7809,\tAdjusted R-squared: 0.7658 #> F-statistic: 51.69 on 2 and 29 DF, p-value: 2.744e-10 #> summary(model_trans) #> #> Call: #> lm(formula = paste(\"mpg ~\", .x), data = mtcars) #> #> Residuals: #> Min 1Q Median 3Q Max #> -6.3800 -3.3063 -0.7567 3.1575 9.0200 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 1.277 8.217 0.155 0.87764 #> gear 4.943 2.539 1.947 0.06163 . #> am 44.578 14.010 3.182 0.00356 ** #> gear:am -9.838 3.614 -2.722 0.01103 * #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 4.512 on 28 degrees of freedom #> Multiple R-squared: 0.4938,\tAdjusted R-squared: 0.4396 #> F-statistic: 9.105 on 3 and 28 DF, p-value: 0.0002282 #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a tidy selection to a vector of column names — untidyselect","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"Returns column names selected expression character vector (default) list symbols (syms = TRUE).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"","code":"untidyselect(data, selection, syms = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"","code":"dplyr::storms %>% untidyselect(c(name:hour, category, tidyselect::ends_with(\"diameter\"))) #> [1] \"name\" \"year\" #> [3] \"month\" \"day\" #> [5] \"hour\" \"category\" #> [7] \"tropicalstorm_force_diameter\" \"hurricane_force_diameter\" mtcars %>% untidyselect(mpg:drat, syms = TRUE) #> [[1]] #> mpg #> #> [[2]] #> cyl #> #> [[3]] #> disp #> #> [[4]] #> hp #> #> [[5]] #> drat #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/winsorize.html","id":null,"dir":"Reference","previous_headings":"","what":"Winsorize extreme values — winsorize","title":"Winsorize extreme values — winsorize","text":"Sets values max_dev deviations center max_dev deviations center. Deviations defined standard deviation (default) mean absolute deviation (method = \"mad\"). Center defined mean method = \"sd\" median method = \"mad\", unless otherwise specified center argument.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/winsorize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Winsorize extreme values — winsorize","text":"","code":"winsorize( x, max_dev = 3, method = c(\"sd\", \"mad\"), mad.center = c(\"median\", \"mean\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/wkappa.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Cohen's kappa and weighted kappa — wkappa","title":"Compute Cohen's kappa and weighted kappa — wkappa","text":"tidyverse-friendly wrapper around psych::cohen.kappa().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/wkappa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Cohen's kappa and weighted kappa — wkappa","text":"","code":"wkappa(.data, x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a styled data frame to an Excel file — write_xlsx_styled","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"wrapper around openxlsx::write.xlsx() default styling options including frozen, bolded row headings auto column widths.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"","code":"write_xlsx_styled(x, file, asTable = FALSE, overwrite = TRUE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"x data frame write. file path output Excel file. asTable Whether write Excel table. overwrite Whether overwrite existing file. ... Additional arguments passed openxlsx::write.xlsx().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/zap_everything.html","id":null,"dir":"Reference","previous_headings":"","what":"Strip special attributes from SPSS dataset — zap_everything","title":"Strip special attributes from SPSS dataset — zap_everything","text":"Removes special attributes data read SPSS, optionally converting labelled vectors factors .as_factor = TRUE (default).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/zap_everything.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Strip special attributes from SPSS dataset — zap_everything","text":"","code":"zap_everything(.data, ..., .as_factor = TRUE)"},{"path":[]},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"summary-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Summary functions","title":"lighthouse 0.7.0","text":"summary_report() returns summary multiple variables, summarizing variable based level measurement. df_compare() utility identifying differences data frames. Given two data frames, returns rows columns differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-missing-values-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for missing values","title":"lighthouse 0.7.0","text":"na_if_range() renamed, expanded, bug-fixed version coerce_na_range(). coerce_na_range() retained alias back compatibility. drop_na_rows() drops rows columns specific subset columns NA. first_valid(), last_valid(), nth_valid() return nth non-missing value vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-character-vectors-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for character vectors","title":"lighthouse 0.7.0","text":"str_c_narm() variant stringr::str_c() alternative handling NAs. str_c_tidy() variant stringr::str_c() accepts tidyselect expressions. str_ends_any() added complement str_starts_any() str_detect_any().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-dates-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for dates","title":"lighthouse 0.7.0","text":"ffy() sfy_il() return federal fiscal year Illinois state fiscal year given date. wrap fiscal_year(), returns fiscal year based specified starting month. strftime_no_lead() formats date without leading zeroes (e.g., “6/7/2024” instead “06/07/2024”). nth_bizday() generalization next_bizday().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-service-cascades-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for service cascades","title":"lighthouse 0.7.0","text":"cascade_fill_bwd() cascade_fill_fwd() impute values service cascade data based previous subsequent cascade steps. cascade_summarize() returns summary table service cascade data. functions yet fully documented.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"statistical-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Statistical functions","title":"lighthouse 0.7.0","text":"se_mean() se_prop() compute standard error mean proportion, respectively. se_prop() includes checks unreliability due low variance; see “Details.” se_mean() replaces ambiguously-named se(), now deprecated. ci_sig() tests confidence interval indicates statistical significance. OR_to_p1() OR_to_p2() convert odds ratios probabilities. complement p_to_OR(). dunn_test() performs Dunn’s test, pairwise post-hoc test following Kruskal-Wallis test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"math-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Math functions","title":"lighthouse 0.7.0","text":"row_sums_across() variant base::rowSums() accepts tidyselect expressions alternative NA handling. sum_if_any(), min_if_any(), max_if_any() variants sum(), min(), max() remove NAs unless values NA. min_if_any() max_if_any() renamed safe_min() safe_max().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"variable-transformation-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Variable transformation","title":"lighthouse 0.7.0","text":"fct_collapse_alt() variant forcats::fct_collapse() options handle non-existent values level ordering. fct_na_if() variant dplyr::na_if() also removes specified value factor’s levels. swap() swaps values two columns. unconditional variant swap_if().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"data-restructuring-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Data restructuring","title":"lighthouse 0.7.0","text":"add_rows_at_value() similar add_blank_rows(), allows specifying position column values rather row numbers. Note changes function interface pre-release version; see “Details” section documentation. pad_vectors() pads list vectors NAs common length.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"exporting-results-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Exporting results","title":"lighthouse 0.7.0","text":"add_plot_slide() helper exporting plots PowerPoint easier control size positioning. write_xlsx_styled() writes .xlsx basic column formatting.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"data-visualization-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Data visualization","title":"lighthouse 0.7.0","text":"add_crossings() helper creating area charts different fills positive vs negative values. after_opacity() before_opacity() utilities color blending.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Other","title":"lighthouse 0.7.0","text":"open_file() (alias file.open()) opens file default application. open_folder() (alias dir.open()) opens folder system file manager. Given two vectors, set_compare() returns labelled subsets unique shared elements. suppress_warnings_if() suppress_messages_if() conditionally suppress warnings messages based text. eq_shape() checks two objects number dimensions length along dimension.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"new-datasets-0-7-0","dir":"Changelog","previous_headings":"","what":"New datasets","title":"lighthouse 0.7.0","text":"gain_missing_codes quick reference missing value labels used GAIN datasets. state.terr.name state.terr.abb versions state.name state.abb include US territories District Columbia. state.terr.data data frame including names, abbreviations, FIPS codes US states, territories, District Columbia.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"added-functionality-0-7-0","dir":"Changelog","previous_headings":"","what":"Added functionality","title":"lighthouse 0.7.0","text":"count_pct() count_multiple() now support .argument per-operation grouping. Integration .count_*() functions planned future update. summary_table(), column variable names can dropped one variable included setting .var_col_name = NULL (#9). count_duplicates() now returns unique total number duplicated values. (e.g., c(2, 2, 4, 4) two unique four total values.) Added missing argument swap_if() options cases condition missing. Added warn_factor argument try_numeric()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"bug-fixes-0-7-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"lighthouse 0.7.0","text":".cols_group_by argument summary_table() now produces separate columns group (fixes #6). count_with_total() now produces totals non-character columns (fixes #10). days_diff() now handles inputs different types (e.g., date datetime) warning (previously threw error). Added General Election Day holidays_il arranged date (fixes #1). Removed Inauguration Day holidays_us.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-changes-0-7-0","dir":"Changelog","previous_headings":"","what":"Other changes","title":"lighthouse 0.7.0","text":"asterisks(), changed default include_key TRUE FALSE. percent() comma() re-exported scales (#11).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lifecycle-changes-0-7-0","dir":"Changelog","previous_headings":"","what":"Lifecycle changes","title":"lighthouse 0.7.0","text":"rbool() un-deprecated. previously deprecated favor purrr::rbernoulli(), purrr::rbernoulli() since deprecated . pivot_wider_alt() defunct. Changes tidyr::pivot_wider() made important functionality unnecessary. changes tidyr broke , judged worth effort fixing. na_like() median_dbl() deprecated. longer needed given flexible handling mixed classes dplyr::if_else() dplyr::case_when() [dplyr v1.1.0][https://dplyr.tidyverse.org/news/index.html#vctrs-1-1-0]. (Plus na_like() quite buggy unreliable; resolves #2). row_sums_spss() deprecated favor row_sums_across(). safe_min() safe_max() renamed min_if_any() max_if_any(); old names deprecated. se() renamed se_mean(); old name deprecated.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"new-functions-0-6-0","dir":"Changelog","previous_headings":"","what":"New functions","title":"lighthouse 0.6.0","text":"group_with_total() count_multiple() count_unique() count_duplicates() cols_info() wkappa() cohen_w() median_dbl() safe_min(), safe_max() pmin_across(), pmax_across() cumsum_desc() scale_vec() reverse_key() add_header() t_tibble() rev_rows() fct_reorder_n() find_na_cols(), drop_na_cols() n_valid(), pct_valid(), n_pct_valid() discard_na() null_to_na() is_valid() str_prefix(), str_suffix() glue_chr() datetimes_to_date() next_bizday() is_duplicate() is_spss() is_coercible_integer(), is_coercible_logical() gain_ss_score()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-changes-0-6-0","dir":"Changelog","previous_headings":"","what":"Other changes","title":"lighthouse 0.6.0","text":"Added datasets federal (holidays_us), Illinois (holidays_il), Chestnut Health Systems (holidays_chestnut) holidays (primarily use withnext_bizday()` function). Added strict argument is_TRUE(), is_FALSE(), is_TRUE_or_NA(), is_FALSE_or_NA() Improvements set_ggplot_opts(), ggview(), is_coercible_numeric() Bugfixes in_excel(), count_na(), summary_table(), pivot_wider_alt(), print_all(), asterisks(), coerce_na_range() Remove check lighthouse updates load","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-050","dir":"Changelog","previous_headings":"","what":"lighthouse 0.5.0","title":"lighthouse 0.5.0","text":"Check lighthouse update available load New infix operators: %all_in%, %any_in% Exported na_like()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-041","dir":"Changelog","previous_headings":"","what":"lighthouse 0.4.1","title":"lighthouse 0.4.1","text":"Bugfix print_all()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-040","dir":"Changelog","previous_headings":"","what":"lighthouse 0.4.0","title":"lighthouse 0.4.0","text":"New logical tests: is_TRUE(), is_FALSE(), is_TRUE_or_NA(), is_FALSE_or_NA(), is_coercible_numeric() New count functions: crosstab(), count_na() New data transformations: scale_mad(), winsorize() New date functions: floor_month(), floor_week(), floor_days(), days_diff() new functions: asterisks(), print_n(), print_all(), na_to_null(), set_ggplot_opts() Added added optional name argument in_excel()","code":""}] +[{"path":"https://ccsarapas.github.io/lighthouse/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2021 lighthouse authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Casey Sarapas. Author, maintainer.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sarapas C (2024). lighthouse: Utility Functions Lighthouse Institute Projects. R package version 0.7.0, https://ccsarapas.github.io/lighthouse/, https://github.com/ccsarapas/lighthouse.","code":"@Manual{, title = {lighthouse: Utility Functions for Lighthouse Institute Projects}, author = {Casey Sarapas}, year = {2024}, note = {R package version 0.7.0, https://ccsarapas.github.io/lighthouse/}, url = {https://github.com/ccsarapas/lighthouse}, }"},{"path":"https://ccsarapas.github.io/lighthouse/index.html","id":"lighthouse","dir":"","previous_headings":"","what":"Utility Functions for Lighthouse Institute Projects","title":"Utility Functions for Lighthouse Institute Projects","text":"lighthouse package includes various utility functions used staff Lighthouse Institute, division Chestnut Health Systems.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Utility Functions for Lighthouse Institute Projects","text":"Install lighthouse package running:","code":"remotes::install_github(\"ccsarapas/lighthouse\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute common accuracy and agreement metrics — accuracy_stats","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"Given vector true_values one vectors test values (passed ...), computes sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), Cohen's kappa.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"","code":"accuracy_stats(.data, true_values, ..., include_counts = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/accuracy_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute common accuracy and agreement metrics — accuracy_stats","text":"","code":"# create example data w predictors with different properties: ex_data <- tibble::tibble( actual = rbinom(250, 1, .3), # 250 cases, p(outcome) = .3 prediction1 = ifelse(runif(250) <= .05, 1L - actual, actual), # 5% error rate prediction2 = ifelse(runif(250) <= .15, 1L - actual, actual), # 15% error rate prediction3 = ifelse(runif(250) <= .35, 1L - actual, actual), # 35% error rate prediction4 = ifelse(runif(250) <= .15, 1L, actual), # 15% with positive bias prediction5 = ifelse(runif(250) <= .15, 0L, actual) # 15% with negative bias ) # testing predicted v actual values ex_data %>% accuracy_stats(actual, prediction1) #> # A tibble: 1 × 7 #> Predictor n Kappa Sensitivity Specificity PPV NPV #> #> 1 prediction1 250 0.845 0.901 0.947 0.890 0.952 # can test multiple predictors simultaneously ex_data %>% accuracy_stats(actual, prediction1:prediction5) #> # A tibble: 5 × 7 #> Predictor n Kappa Sensitivity Specificity PPV NPV #> #> 1 prediction1 250 0.845 0.901 0.947 0.890 0.952 #> 2 prediction2 250 0.628 0.840 0.822 0.694 0.914 #> 3 prediction3 250 0.213 0.593 0.639 0.440 0.766 #> 4 prediction4 250 0.828 1 0.882 0.802 1 #> 5 prediction5 250 0.846 0.802 1 1 0.914 # if `include_counts` = TRUE, will also return n of false positives, # false negatives, etc., as well as and observed and expected % agreement ex_data %>% accuracy_stats(actual, prediction1:prediction5, include_counts = TRUE) #> # A tibble: 5 × 13 #> Predictor n TP FP TN FN pAgreeObserved pAgreeExpected Kappa #> #> 1 prediction1 250 73 9 160 8 0.932 0.561 0.845 #> 2 prediction2 250 68 30 139 13 0.828 0.538 0.628 #> 3 prediction3 250 48 61 108 33 0.624 0.523 0.213 #> 4 prediction4 250 81 20 149 0 0.92 0.534 0.828 #> 5 prediction5 250 65 0 169 16 0.936 0.584 0.846 #> # ℹ 4 more variables: Sensitivity , Specificity , PPV , #> # NPV "},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":null,"dir":"Reference","previous_headings":"","what":"Add crossings to a dataframe for area charts — add_crossings","title":"Add crossings to a dataframe for area charts — add_crossings","text":"Augments dataframe x-values y = f(x) = 0. useful creating area charts different fills values less versus greater 0.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add crossings to a dataframe for area charts — add_crossings","text":"","code":"add_crossings(data, x, y, .by = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add crossings to a dataframe for area charts — add_crossings","text":"data data frame containing original x y values. x x-axis values. y y-axis values. .Grouping variable(s). Useful computing crossings faceted plots.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add crossings to a dataframe for area charts — add_crossings","text":"input data frame additional rows representing crossings (y = 0), two new columns: pos_neg: Indicates whether y-value positive (\"pos\") negative (\"neg\"). cross_grp: grouping variable segments crossings.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add crossings to a dataframe for area charts — add_crossings","text":"returned dataframe include columns pos_neg cross_group. Within geom_area(), cross_group mapped group, pos_neg mapped aesthetics fill color.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_crossings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add crossings to a dataframe for area charts — add_crossings","text":"","code":"nile_flow <- tibble::tibble( Year = time(Nile), Flow = as.numeric(Nile), FlowDelta = (Flow - Flow[[1]]) / Flow[[1]] ) nile_flow_x0 <- add_crossings(nile_flow, Year, FlowDelta) ggplot2::ggplot(nile_flow_x0, ggplot2::aes(Year, FlowDelta)) + ggplot2::geom_area( ggplot2::aes(group = cross_grp, color = pos_neg, fill = pos_neg), alpha = 0.25, show.legend = FALSE ) + ggplot2::geom_hline(yintercept = 0, linewidth = 0.25) + ggplot2::scale_color_manual( values = c(\"darkred\", \"blue\"), aesthetics = c(\"color\", \"fill\") ) + ggplot2::scale_y_continuous( \"Nile River Annual Flow:\\n% Change from 1871\", labels = scales::percent ) + ggplot2::theme_minimal()"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_empty_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add empty rows — add_empty_rows","title":"Add empty rows — add_empty_rows","text":"Adds number empty rows passed .nrows (default 1) positions passed ... Vectorized ., ., .nrows.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_empty_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add empty rows — add_empty_rows","text":"","code":"add_empty_rows(.data, .before = NULL, .after = NULL, .nrows = 1)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":null,"dir":"Reference","previous_headings":"","what":"Add header rows to a table — add_header","title":"Add header rows to a table — add_header","text":"Inserts header rows using unique values .","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add header rows to a table — add_header","text":"","code":"add_header( data, from, to, skip_single_row = FALSE, indent = \"\", drop_from = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_header.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add header rows to a table — add_header","text":"","code":"dplyr::starwars %>% head(13) %>% dplyr::arrange(species) %>% add_header(from = species, to = name, indent = \" \") #> # A tibble: 16 × 13 #> name height mass hair_color skin_color eye_color birth_year sex gender #> #> 1 \"Droid\" NA NA NA NA NA NA NA NA #> 2 \" C-3P… 167 75 NA gold yellow 112 none mascu… #> 3 \" R2-D… 96 32 NA white, bl… red 33 none mascu… #> 4 \" R5-D… 97 32 NA white, red red NA none mascu… #> 5 \"Human\" NA NA NA NA NA NA NA NA #> 6 \" Luke… 172 77 blond fair blue 19 male mascu… #> 7 \" Dart… 202 136 none white yellow 41.9 male mascu… #> 8 \" Leia… 150 49 brown light brown 19 fema… femin… #> 9 \" Owen… 178 120 brown, gr… light blue 52 male mascu… #> 10 \" Beru… 165 75 brown light blue 47 fema… femin… #> 11 \" Bigg… 183 84 black light brown 24 male mascu… #> 12 \" Obi-… 182 77 auburn, w… fair blue-gray 57 male mascu… #> 13 \" Anak… 188 84 blond fair blue 41.9 male mascu… #> 14 \" Wilh… 180 NA auburn, g… fair blue 64 male mascu… #> 15 \"Wookie… NA NA NA NA NA NA NA NA #> 16 \" Chew… 228 112 brown unknown blue 200 male mascu… #> # ℹ 4 more variables: homeworld , films , vehicles , #> # starships "},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a plot to a PowerPoint slide — add_plot_slide","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"function adds new slide PowerPoint presentation plot centered beneath title, scaled large possible within specified margins preserving aspect ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"","code":"add_plot_slide( pptx, title = NULL, plot = ggplot2::last_plot(), w = 7, h = 4, bg = \"white\", w_margin = 0.15, h_margin = 0.15, layout = \"Title and Content\", ... )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"pptx object class rpptx, created officer::read_pptx() title optional slide title plot plot add. Default last plot created. w plot width inches h plot height inches bg background color plot area w_margin horizontal margin inches h_margin vertical margin inches layout slide layout use ... additional arguments passed officer::ph_with()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"updated rpptx object","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_plot_slide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a plot to a PowerPoint slide — add_plot_slide","text":"","code":"if (FALSE) { # \\dontrun{ library(ggplot2) library(officer) plot <- ggplot(mtcars, aes(mpg, wt)) + geom_point() pptx <- read_pptx() pptx <- pptx |> add_plot_slide(\"Larger Elements\", plot, w = 5, h = 3.5) |> add_plot_slide(\"Smaller Elements\", plot, w = 10, h = 7) |> add_plot_slide(\"Wider\", plot, w = 9, h = 3) |> add_plot_slide(\"Taller\", plot, w = 4, h = 6) path <- paste0(tempfile(), \".pptx\") print(pptx, target = path) file.open(path) invisible(file.remove(path)) } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":null,"dir":"Reference","previous_headings":"","what":"Add empty rows at specified values in a column — add_rows_at_value","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"Adds empty row(s) based specified value(s) col. default, insert one empty row last occurrence col value passed vals.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"","code":"add_rows_at_value( .data, col, vals, where = c(\"after_last\", \"before_first\", \"after_each\", \"before_each\"), no_match = c(\"error\", \"warn\", \"ignore\"), nrows = 1, ... )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add empty rows at specified values in a column — add_rows_at_value","text":".data data frame data frame extension. col column search values. vals character vector value(s) search col. insert rows relative values vals. nrows number empty rows insert location. ... dots included support error-checking must empty. nomatch value vals appear col.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"updated version .data new empty rows inserted.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"pre-release version function, used lighthouse code, values search passed ... unquoted symbols. Values must now now instead passed vals character vector. arguments ..nrows also renamed nrows. function attempt detect give informative warning called \"old\" parameters (e.g., deprecated argument list symbols rather character vector). Also see syms_to_chr(), provided utility adapting old code.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/add_rows_at_value.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add empty rows at specified values in a column — add_rows_at_value","text":"","code":"set.seed(13) ex_data <- tibble::tibble( category = sort(sample(LETTERS[1:3], 10, replace = TRUE)), var = round(runif(10), 2) ) add_rows_at_value(ex_data, category, c(\"A\", \"B\")) #> # A tibble: 12 × 2 #> category var #> #> 1 A 0.87 #> 2 A 0.68 #> 3 A 0.14 #> 4 A 0.55 #> 5 NA NA #> 6 B 0.68 #> 7 B 0.53 #> 8 B 0.09 #> 9 B 0.62 #> 10 NA NA #> 11 C 0.03 #> 12 C 0.46 add_rows_at_value(ex_data, category, c(\"A\", \"C\"), where = \"after_each\") #> # A tibble: 16 × 2 #> category var #> #> 1 A 0.87 #> 2 NA NA #> 3 A 0.68 #> 4 NA NA #> 5 A 0.14 #> 6 NA NA #> 7 A 0.55 #> 8 NA NA #> 9 B 0.68 #> 10 B 0.53 #> 11 B 0.09 #> 12 B 0.62 #> 13 C 0.03 #> 14 NA NA #> 15 C 0.46 #> 16 NA NA add_rows_at_value( ex_data, category, unique(ex_data$category), where = \"before_first\", nrows = 2 ) #> # A tibble: 16 × 2 #> category var #> #> 1 NA NA #> 2 NA NA #> 3 A 0.87 #> 4 A 0.68 #> 5 A 0.14 #> 6 A 0.55 #> 7 NA NA #> 8 NA NA #> 9 B 0.68 #> 10 B 0.53 #> 11 B 0.09 #> 12 B 0.62 #> 13 NA NA #> 14 NA NA #> 15 C 0.03 #> 16 C 0.46"},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"Returns sum, maximum, minimum input values, similar base::sum(), min(), max(). Unlike base functions, variants return NA values NA na.rm = TRUE. (base::sum(), min(), max() return 0, -Inf, Inf, respectively, situation). Also unlike base functions, na.rm TRUE default (since typical use case).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"","code":"sum_if_any(..., na.rm = TRUE) max_if_any(..., na.rm = TRUE) min_if_any(..., na.rm = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"... numeric, logical, (max_if_any() min_if_any()) character vectors. na.rm logical. missing values (including NaN) removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/aggregate_if_any.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sum, maxima and minima with alternative missing value handling — aggregate_if_any","text":"","code":"some_na <- c(1, 2, NA) all_na <- c(NA, NA, NA) # unlike base functions, `na.rm = TRUE` by default max(some_na) #> [1] NA max_if_any(some_na) #> [1] 2 # unlike base functions, returns 0 when `na.rm = TRUE` and all inputs are `NA` sum(all_na, na.rm = TRUE) #> [1] 0 sum_if_any(all_na) #> [1] NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether multiple values are in a vector — any-all-in","title":"Test whether multiple values are in a vector — any-all-in","text":"infix operators test whether left-hand side elements occur right-hand side.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether multiple values are in a vector — any-all-in","text":"","code":"lhs %all_in% rhs lhs %any_in% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test whether multiple values are in a vector — any-all-in","text":"%all_in% returns TRUE elements left operand (lhs) found right operand (rhs). Equivalent (lhs %% rhs). %any_in% returns TRUE elements left operand (lhs) found right operand (rhs). Equivalent (lhs %% rhs).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/any-all-in.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test whether multiple values are in a vector — any-all-in","text":"","code":"maybe_states <- c(\"Idaho\", \"Illinois\", \"North Tuba\", \"Maine\") maybe_states %any_in% state.name # TRUE #> [1] TRUE maybe_states %all_in% state.name # FALSE #> [1] FALSE rm(maybe_states)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":null,"dir":"Reference","previous_headings":"","what":"Return asterisks corresponding to p-values — asterisks","title":"Return asterisks corresponding to p-values — asterisks","text":"Returns asterisks indicating significance levels vector p values.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return asterisks corresponding to p-values — asterisks","text":"","code":"asterisks( p, trends = TRUE, levels = c(0.1, 0.05, 0.01, 0.001), marks = c(sig = \"*\", trend = \"+\", ns = NA_character_), include_key = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return asterisks corresponding to p-values — asterisks","text":"p numeric vector p-values. trends logical. trends (e.g., .05 < p < .10) marked? levels numeric vector demarcating ranges p values receive unique significance marks. marks named character vector specifying marks significance, trend, non-significance. include_key logical. key significance marks included attribute?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return asterisks corresponding to p-values — asterisks","text":"character vector asterisks corresponding p-values. include_key = TRUE, vector 'key' attribute indicating significance levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/asterisks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return asterisks corresponding to p-values — asterisks","text":"","code":"p <- c(0.5, 0.09, 0.03, 0.008, 0.0003) tibble::tibble(p, sig = asterisks(p)) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 NA #> 2 0.09 + #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** tibble::tibble(p, sig = asterisks(p, trends = FALSE)) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 NA #> 2 0.09 NA #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** tibble::tibble(p, sig = asterisks(p, trends = FALSE, marks = c(ns = \"ns\"))) #> # A tibble: 5 × 2 #> p sig #> #> 1 0.5 ns #> 2 0.09 ns #> 3 0.03 * #> 4 0.008 ** #> 5 0.0003 *** asterisks(p, include_key = TRUE) #> [1] + * ** *** #> attr(,\"key\") #> *** ** * + #> 0.001 0.010 0.050 0.100 #> Levels: *** ** * +"},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":null,"dir":"Reference","previous_headings":"","what":"Find the nth or next business day — bizday","title":"Find the nth or next business day — bizday","text":"nth_bizday() returns nth business day given date, based CHS, Illinois, federal holidays. next_bizday() wrapper ","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find the nth or next business day — bizday","text":"","code":"nth_bizday( x, n, include_today = FALSE, holidays = c(\"Chestnut\", \"Illinois\", \"federal\") ) next_bizday( x, include_today = FALSE, holidays = c(\"Chestnut\", \"Illinois\", \"federal\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find the nth or next business day — bizday","text":"x date vector dates. n integer indicating ow many business days forward find. include_today logical indicating whether x counted one day (assuming business day)? holidays character indicating set holidays use.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find the nth or next business day — bizday","text":"nth_bizday returns nth business day provided date(s). next_bizday returns next business day provided date(s).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/bizday.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Find the nth or next business day — bizday","text":"","code":"next_bizday(as.Date(\"2024-07-02\")) #> [1] \"2024-07-03\" nth_bizday(as.Date(\"2024-07-02\"), 5) #> [1] \"2024-07-10\" nth_bizday(as.Date(\"2024-07-02\"), 5, include_today = TRUE) #> [1] \"2024-07-09\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cascade.html","id":null,"dir":"Reference","previous_headings":"","what":"Utilities for service cascades — cascade","title":"Utilities for service cascades — cascade","text":"Functions working service cascades.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cascade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utilities for service cascades — cascade","text":"","code":"cascade_fill_bwd(data, vars) cascade_fill_fwd(data, vars, fill = c(\"NA\", \"FALSE\")) cascade_summarize(data, vars)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether a confidence interval excludes a given value — ci_sig","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"Tests whether confidence interval excldes specified reference value. generally null value relevant test, excluding value indicates test statistically significant.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"","code":"ci_sig( ll, ul, reference = 1, return = c(\"logical\", \"asterisks\"), marks = c(\"*\", NA_character_) )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"ll numeric vector containing confidence interval lower limits. ul numeric vector containing corresponding upper limits. reference value check . generally null value relevant test (e.g., 1 odds ratios, 0 beta coefficients). return \"logical\", return logical vector indicating whether confidence interval excludes reference. asterisks, return character vector, using characters passed marks. marks length-2 vector specifying strings mark significant non-significant results return = \"asterisks\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"return = \\\"logical\\\" (default), logical vector. return = \\\"asterisks\\\", character vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ci_sig.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test whether a confidence interval excludes a given value — ci_sig","text":"","code":"beta_CIs <- glm( Survived ~ Sex * Age, family = binomial, weights = Freq, data = as.data.frame(Titanic) ) %>% confint() #> Waiting for profiling to be done... OR_CIs <- tibble::as_tibble(exp(beta_CIs), rownames = \"term\") beta_CIs <- tibble::as_tibble(beta_CIs, rownames = \"term\") beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`)) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 TRUE #> 2 SexFemale -0.0834 1.48 FALSE #> 3 AgeAdult -1.69 -0.669 TRUE #> 4 SexFemale:AgeAdult 0.918 2.56 FALSE beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, return = \"asterisks\")) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 * #> 2 SexFemale -0.0834 1.48 NA #> 3 AgeAdult -1.69 -0.669 * #> 4 SexFemale:AgeAdult 0.918 2.56 NA beta_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, return = \"asterisks\", marks = c(\"*\", \"ns\"))) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) -0.687 0.303 * #> 2 SexFemale -0.0834 1.48 ns #> 3 AgeAdult -1.69 -0.669 * #> 4 SexFemale:AgeAdult 0.918 2.56 ns OR_CIs %>% dplyr::mutate(sig = ci_sig(`2.5 %`, `97.5 %`, reference = 1, return = \"asterisks\")) #> # A tibble: 4 × 4 #> term `2.5 %` `97.5 %` sig #> #> 1 (Intercept) 0.503 1.35 NA #> 2 SexFemale 0.920 4.39 NA #> 3 AgeAdult 0.185 0.512 * #> 4 SexFemale:AgeAdult 2.50 12.9 *"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Cohen's w — cohen_w","title":"Compute Cohen's w — cohen_w","text":"Cohen's w effect size measure associations nominal variables, generally used conjunction chi-squared tests. cohen_w() computes Cohen's w results chi-squared test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Cohen's w — cohen_w","text":"","code":"cohen_w(chisq)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Cohen's w — cohen_w","text":"chisq \"htest\" object returned stats::chisq.test().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cohen_w.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Cohen's w — cohen_w","text":"","code":"chisq_out <- chisq.test(ggplot2::diamonds$cut, ggplot2::diamonds$color) cohen_w(chisq_out) #> [1] 0.07584867"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Get information about data frame columns — cols_info","title":"Get information about data frame columns — cols_info","text":"Returns summary column's class, type, missing data. data frame imported SPSS .sav file \\\"labelled\\\" package installed, SPSS variable labels also included.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get information about data frame columns — cols_info","text":"","code":"cols_info(x, zap_spss = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get information about data frame columns — cols_info","text":"x data frame. zap_spss TRUE (default) \\\"labelled\\\" package available, convert SPSS-style labeled columns standard R columns. Ignored \\\"labelled\\\" installed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get information about data frame columns — cols_info","text":"tibble row column x, containing: column: Column name class: Column class type: Column type valid_n: Number non-missing values valid_pct: Percentage non-missing values label: SPSS variable label (applicable)","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cols_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get information about data frame columns — cols_info","text":"","code":"cols_info(dplyr::starwars) #> # A tibble: 14 × 5 #> column class type valid_n valid_pct #> #> 1 name character character 87 1 #> 2 height integer integer 81 0.931 #> 3 mass numeric double 59 0.678 #> 4 hair_color character character 82 0.943 #> 5 skin_color character character 87 1 #> 6 eye_color character character 87 1 #> 7 birth_year numeric double 43 0.494 #> 8 sex character character 83 0.954 #> 9 gender character character 83 0.954 #> 10 homeworld character character 77 0.885 #> 11 species character character 83 0.954 #> 12 films list list 87 1 #> 13 vehicles list list 87 1 #> 14 starships list list 87 1"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":null,"dir":"Reference","previous_headings":"","what":"Count duplicates across specified columns — count_duplicates","title":"Count duplicates across specified columns — count_duplicates","text":"variant dplyr::count() returns number duplicate observations across specified columns. Returns number unique duplicated values, well total number duplicated observations.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count duplicates across specified columns — count_duplicates","text":"","code":"count_duplicates(.data, ..., na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count duplicates across specified columns — count_duplicates","text":".data data frame. ... Columns use duplicate checks. empty, columns used. na.rm TRUE, rows containing NA specified columns removed counting duplicates.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count duplicates across specified columns — count_duplicates","text":"data frame columns: instances: number times unique value duplicated n_unique: number unique values duplicated instances times n_total: total number observations duplicated instances times","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_duplicates.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count duplicates across specified columns — count_duplicates","text":"","code":"df <- tibble::tibble( x = c(1, 1, 2, 3, 3), y = c('a', 'a', 'b', 'c', 'c') ) count_duplicates(df) #> # A tibble: 1 × 3 #> instances n_unique n_total #> #> 1 5 1 5 count_duplicates(df, x) #> # A tibble: 2 × 3 #> instances n_unique n_total #> #> 1 1 1 1 #> 2 2 2 4 count_duplicates(df, y) #> # A tibble: 2 × 3 #> instances n_unique n_total #> #> 1 1 1 1 #> 2 2 2 4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations for multiple variables — count_multiple","title":"Count observations for multiple variables — count_multiple","text":"variant dplyr::count() returns frequencies (optionally) proportions column passed ....","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations for multiple variables — count_multiple","text":"","code":"count_multiple( .data, ..., .pct = TRUE, wt = NULL, sort = FALSE, name = NULL, na.rm = FALSE, .by = NULL, .drop = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations for multiple variables — count_multiple","text":".data data frame. ... Columns count frequencies . Can named expressions. .pct TRUE (default), include percentages. sort TRUE, sort output frequency. name Name frequency column. Default \\\"n\\\". na.rm TRUE, remove rows NA values. .selection columns group just operation, functioning alternative dplyr::group_by(). Percentages computed within group rather grand total. See examples. .drop TRUE (default), drop unused factor levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations for multiple variables — count_multiple","text":"data frame columns: grouping variables input data specified .. Variable: name column counted. Value: unique values counted column. n: frequency unique value. pct: (.pct = TRUE) percentage count represents within variable.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_multiple.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations for multiple variables — count_multiple","text":"","code":"iris %>% count_multiple(Species, Sepal.Length > 5) #> # A tibble: 5 × 4 #> Variable Value n pct #> #> 1 Species setosa 50 0.333 #> 2 Species versicolor 50 0.333 #> 3 Species virginica 50 0.333 #> 4 Sepal.Length > 5 FALSE 32 0.213 #> 5 Sepal.Length > 5 TRUE 118 0.787 ## note effects of grouping # no grouping ggplot2::mpg %>% count_multiple(year, drv, cyl) #> # A tibble: 9 × 4 #> Variable Value n pct #> #> 1 year 1999 117 0.5 #> 2 year 2008 117 0.5 #> 3 drv 4 103 0.440 #> 4 drv f 106 0.453 #> 5 drv r 25 0.107 #> 6 cyl 4 81 0.346 #> 7 cyl 5 4 0.0171 #> 8 cyl 6 79 0.338 #> 9 cyl 8 70 0.299 # grouping w `group_by()`: counts and % nested within groups, output is grouped ggplot2::mpg %>% dplyr::group_by(year) %>% count_multiple(drv, cyl) #> # A tibble: 13 × 5 #> # Groups: year [2] #> year Variable Value n pct #> #> 1 1999 drv 4 49 0.419 #> 2 1999 drv f 57 0.487 #> 3 1999 drv r 11 0.0940 #> 4 2008 drv 4 54 0.462 #> 5 2008 drv f 49 0.419 #> 6 2008 drv r 14 0.120 #> 7 1999 cyl 4 45 0.385 #> 8 1999 cyl 6 45 0.385 #> 9 1999 cyl 8 27 0.231 #> 10 2008 cyl 4 36 0.308 #> 11 2008 cyl 5 4 0.0342 #> 12 2008 cyl 6 34 0.291 #> 13 2008 cyl 8 43 0.368 # grouping w `.by`: counts and % nested within groups, output isn't grouped ggplot2::mpg %>% count_multiple(drv, cyl, .by = year) #> # A tibble: 13 × 5 #> year Variable Value n pct #> #> 1 1999 drv 4 49 0.419 #> 2 1999 drv f 57 0.487 #> 3 1999 drv r 11 0.0940 #> 4 2008 drv 4 54 0.462 #> 5 2008 drv f 49 0.419 #> 6 2008 drv r 14 0.120 #> 7 1999 cyl 4 45 0.385 #> 8 1999 cyl 6 45 0.385 #> 9 1999 cyl 8 27 0.231 #> 10 2008 cyl 4 36 0.308 #> 11 2008 cyl 5 4 0.0342 #> 12 2008 cyl 6 34 0.291 #> 13 2008 cyl 8 43 0.368"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_na.html","id":null,"dir":"Reference","previous_headings":"","what":"Count NA values by group — count_na","title":"Count NA values by group — count_na","text":"Returns patterns missingness across one variables, number cases pattern.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_na.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count NA values by group — count_na","text":"","code":"count_na( .data, ..., .label_missing = NA_character_, .label_valid = \"OK\", .add_percent = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations with percentage — count_pct","title":"Count observations with percentage — count_pct","text":"variant dplyr::count() includes column showing percentage total observations group.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations with percentage — count_pct","text":"","code":"count_pct( .data, ..., na.rm = FALSE, .by = NULL, wt = NULL, sort = FALSE, .drop = dplyr::group_by_drop_default() )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations with percentage — count_pct","text":"... Variables group . passed dplyr::count(). na.rm TRUE, removes rows NA values calculations. .selection columns group just operation, functioning alternative dplyr::group_by(). Percentages computed within group rather grand total. See examples. wt Frequency weights. Can NULL variable: NULL (default), counts number rows group. variable, computes sum(wt) group. sort TRUE, show largest groups top. .drop Handling factor levels appear data, passed group_by(). count(): FALSE include counts empty groups (.e. levels factors exist data). add_count(): deprecated since actually affect output.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations with percentage — count_pct","text":"data frame columns grouping variables, n (count observations group), pct (percentage total observations group).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Count observations with percentage — count_pct","text":"Percentages within subgroups can obtained grouping group_by","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_pct.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations with percentage — count_pct","text":"","code":"library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union ## note effect of `na.rm` on percentages dplyr::starwars %>% count_pct(gender) #> # A tibble: 3 × 3 #> gender n pct #> #> 1 feminine 17 0.195 #> 2 masculine 66 0.759 #> 3 NA 4 0.0460 dplyr::starwars %>% count_pct(gender, na.rm = TRUE) #> # A tibble: 2 × 3 #> gender n pct #> #> 1 feminine 17 0.205 #> 2 masculine 66 0.795 ## note effect of grouping on percentages # no grouping: % of grand total ggplot2::mpg %>% count_pct(year, cyl) #> # A tibble: 7 × 4 #> year cyl n pct #> #> 1 1999 4 45 0.192 #> 2 1999 6 45 0.192 #> 3 1999 8 27 0.115 #> 4 2008 4 36 0.154 #> 5 2008 5 4 0.0171 #> 6 2008 6 34 0.145 #> 7 2008 8 43 0.184 # grouping w `group_by()`: % of group, output is grouped ggplot2::mpg %>% dplyr::group_by(year) %>% count_pct(cyl) #> # A tibble: 7 × 4 #> # Groups: year [2] #> year cyl n pct #> #> 1 1999 4 45 0.385 #> 2 1999 6 45 0.385 #> 3 1999 8 27 0.231 #> 4 2008 4 36 0.308 #> 5 2008 5 4 0.0342 #> 6 2008 6 34 0.291 #> 7 2008 8 43 0.368 # grouping w `.by`: % of group, output isn't grouped ggplot2::mpg %>% count_pct(cyl, .by = year) #> # A tibble: 7 × 4 #> year cyl n pct #> #> 1 1999 4 45 0.385 #> 2 1999 6 45 0.385 #> 3 1999 8 27 0.231 #> 4 2008 4 36 0.308 #> 5 2008 5 4 0.0342 #> 6 2008 6 34 0.291 #> 7 2008 8 43 0.368"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":null,"dir":"Reference","previous_headings":"","what":"Count unique values in data frame columns — count_unique","title":"Count unique values in data frame columns — count_unique","text":"variant dplyr::count() returns number unique values across set columns data frame.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count unique values in data frame columns — count_unique","text":"","code":"count_unique(.data, ..., name = \"n_unique\", na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count unique values in data frame columns — count_unique","text":".data data frame. ... columns count unique values across. name name give unique count column. na.rm exclude NAs counts?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_unique.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count unique values in data frame columns — count_unique","text":"","code":"mtcars %>% count_unique(cyl, gear) #> n_unique #> 1 8 mtcars %>% count_unique(cyl, gear, carb, name = \"unique_combos\") #> unique_combos #> 1 12"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Count observations with totals row — count_with_total","title":"Count observations with totals row — count_with_total","text":"variant dplyr::count() adds row column totals. Totals computed first column passed ... unless otherwise specified totals_for.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count observations with totals row — count_with_total","text":"","code":"count_with_total( .data, ..., totals_for = NULL, label = \"Total\", first_row = FALSE, wt = NULL, sort = FALSE, name = NULL, .drop = dplyr::group_by_drop_default() )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count observations with totals row — count_with_total","text":"... Variables group . totals_for variable total . omitted, defaults first variable .... label label totals row. Defaults \"Total\". first_row TRUE, totals row placed first output. FALSE (default), placed last. wt Frequency weights. Can NULL variable: NULL (default), counts number rows group. variable, computes sum(wt) group. sort TRUE, show largest groups top. name name new column output. omitted, default n. already column called n, use nn. column called n nn, 'll use nnn, , adding ns gets new name. .drop Handling factor levels appear data, passed dplyr::group_by(). FALSE include counts empty groups (.e. levels factors exist data).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count observations with totals row — count_with_total","text":"data frame counts grouping level, along \"totals\" row column totals totaled variable.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/count_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count observations with totals row — count_with_total","text":"","code":"mtcars %>% count_with_total(cyl) #> cyl n #> 1 4 11 #> 2 6 7 #> 3 8 14 #> 4 Total 32 mtcars %>% count_with_total(cyl, gear) #> cyl gear n #> 1 4 3 1 #> 2 4 4 8 #> 3 4 5 2 #> 4 6 3 2 #> 5 6 4 4 #> 6 6 5 1 #> 7 8 3 12 #> 8 8 5 2 #> 9 Total 3 15 #> 10 Total 4 12 #> 11 Total 5 5 mtcars %>% count_with_total(cyl, gear, totals_for = gear) #> cyl gear n #> 1 4 3 1 #> 2 4 4 8 #> 3 4 5 2 #> 4 4 Total 11 #> 5 6 3 2 #> 6 6 4 4 #> 7 6 5 1 #> 8 6 Total 7 #> 9 8 3 12 #> 10 8 5 2 #> 11 8 Total 14"},{"path":"https://ccsarapas.github.io/lighthouse/reference/crosstab.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross-tabulate observations — crosstab","title":"Cross-tabulate observations — crosstab","text":"Builds contingency table similar base::table(). Unlike base::table(), crosstab() pipe-friendly, outputs ordinary tibble / data.frame – e.g., retain structure exported csv. Currently supports two variables.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/crosstab.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross-tabulate observations — crosstab","text":"","code":"crosstab(.data, ..., .drop = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":null,"dir":"Reference","previous_headings":"","what":"Descending cumulative sum — cumsum_desc","title":"Descending cumulative sum — cumsum_desc","text":"Returns cumulative sum beginning last element x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Descending cumulative sum — cumsum_desc","text":"","code":"cumsum_desc(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/cumsum_desc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Descending cumulative sum — cumsum_desc","text":"","code":"ggplot2::diamonds %>% dplyr::count(cut) %>% dplyr::mutate( or_worse = cumsum(n), or_better = cumsum_desc(n) ) #> # A tibble: 5 × 4 #> cut n or_worse or_better #> #> 1 Fair 1610 1610 53940 #> 2 Good 4906 6516 52330 #> 3 Very Good 12082 18598 47424 #> 4 Premium 13791 32389 35342 #> 5 Ideal 21551 53940 21551"},{"path":"https://ccsarapas.github.io/lighthouse/reference/d_to_OR.html","id":null,"dir":"Reference","previous_headings":"","what":"Conversion between Cohen's d and odds ratio — d_to_OR","title":"Conversion between Cohen's d and odds ratio — d_to_OR","text":"Functions convert Cohen's d odds ratio vice versa.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/d_to_OR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conversion between Cohen's d and odds ratio — d_to_OR","text":"","code":"d_to_OR(d) OR_to_d(OR)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/datetimes_to_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all datetimes in table to dates — datetimes_to_date","title":"Convert all datetimes in table to dates — datetimes_to_date","text":"Returns dataframe datetime columns (.e., class POSIXct POSIXlt) converted Date.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/datetimes_to_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all datetimes in table to dates — datetimes_to_date","text":"","code":"datetimes_to_date(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/days_diff.html","id":null,"dir":"Reference","previous_headings":"","what":"Number of days between two dates — days_diff","title":"Number of days between two dates — days_diff","text":"Returns number days two dates.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/days_diff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Number of days between two dates — days_diff","text":"","code":"days_diff(d1, d2, warn = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":null,"dir":"Reference","previous_headings":"","what":"Compare two data frames and show differences — df_compare","title":"Compare two data frames and show differences — df_compare","text":"Given two data frames dimensions column order, returns data frame including rows columns differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compare two data frames and show differences — df_compare","text":"","code":"df_compare(x, y, suffix = c(\".x\", \".y\"), keep = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compare two data frames and show differences — df_compare","text":"x, y pair data frames suffix suffixes indicate source data frame output. keep <[tidy-select][dplyr_tidy_select> Columns include output even differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compare two data frames and show differences — df_compare","text":"data frame rows columns differing values x y. Differing columns included twice, suffixes appended. Columns specified keep always included.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/df_compare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compare two data frames and show differences — df_compare","text":"","code":"x <- data.frame(id = 1:3, A = c(7, 8, 9), B = c(10, 20, 30), C = c(\"x\", \"y\", \"z\")) y <- data.frame(id = 1:3, A = c(7, 8, 99), B = c(10, 20, 30), C = c(\"X\", \"y\", \"Z\")) df_compare(x, y) #> A.x A.y C.x C.y #> 1 7 7 x X #> 2 9 99 z Z df_compare(x, y, keep = id) #> id A.x A.y C.x C.y #> 1 1 7 7 x X #> 2 3 9 99 z Z"},{"path":"https://ccsarapas.github.io/lighthouse/reference/discard_na.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove missing values — discard_na","title":"Remove missing values — discard_na","text":"Returns vector NAs removed. Similar stats::na.omit.default(), add attributes returned value.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/discard_na.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove missing values — discard_na","text":"","code":"discard_na(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Drop rows where all columns are NA — drop_na_rows","title":"Drop rows where all columns are NA — drop_na_rows","text":"Drops rows specified columns NA. columns specified, columns considered.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Drop rows where all columns are NA — drop_na_rows","text":"","code":"drop_na_rows(data, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Drop rows where all columns are NA — drop_na_rows","text":"data data frame. ... (Optional) Columns test NAs. specified, columns considered.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Drop rows where all columns are NA — drop_na_rows","text":"data frame rows removed contain NA values across (specified) columns.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/drop_na_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Drop rows where all columns are NA — drop_na_rows","text":"","code":"dat <- tibble::tibble( x = c(NA, NA, 3), y = c(NA, NA, 4), z = c(5, NA, NA) ) drop_na_rows(dat) #> # A tibble: 2 × 3 #> x y z #> #> 1 NA NA 5 #> 2 3 4 NA drop_na_rows(dat, x, y) #> # A tibble: 1 × 3 #> x y z #> #> 1 3 4 NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":null,"dir":"Reference","previous_headings":"","what":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"tidy wrapper around dunn.test::dunn.test(). performs Dunn's test, non-parametric pairwise follow-Kruskal-Wallis test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"","code":"dunn_test( x, groups, data, p.adjust.method = c(\"holm\", \"hochberg\", \"bonferroni\", \"bh\", \"by\", \"sidak\", \"hs\", \"none\"), alpha = 0.05 )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"x numeric vector. groups vector factor giving group corresponding elements x. data data frame containing variables. p.adjust.method character. method adjusting p-values multiple comparisons. alpha numeric. alpha level.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"tibble columns: contrast: compared groups. statistic: Dunn's test statistic (z). adj.p.value: Adjusted p-value based specified p.adjust.method.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/dunn_test.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pairwise post-hoc test following Kruskal-Wallis test — dunn_test","text":"","code":"mtcars2 <- transform(mtcars, cyl = factor(cyl)) kruskal.test(mpg ~ gear, data = mtcars2) #> #> \tKruskal-Wallis rank sum test #> #> data: mpg by gear #> Kruskal-Wallis chi-squared = 14.323, df = 2, p-value = 0.0007758 #> dunn_test(mpg, gear, data = mtcars2) #> # A tibble: 3 × 3 #> contrast statistic adj.p.value #> #> 1 3 - 4 -3.76 0.000253 #> 2 3 - 5 -1.65 0.0998 #> 3 4 - 5 1.14 0.127"},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if two objects have the same shape — eq_shape","title":"Test if two objects have the same shape — eq_shape","text":"Checks two objects x y shape, .e., dimensions length vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if two objects have the same shape — eq_shape","text":"","code":"eq_shape(x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test if two objects have the same shape — eq_shape","text":"x object. y object.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test if two objects have the same shape — eq_shape","text":"TRUE x y shape, FALSE otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/eq_shape.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test if two objects have the same shape — eq_shape","text":"","code":"eq_shape(1:5, 1:5) #> [1] TRUE eq_shape(1:5, 1:6) #> [1] FALSE eq_shape(matrix(1:6, nrow = 2), matrix(1:6, nrow = 3)) #> [1] FALSE eq_shape(matrix(1:6, nrow = 2), matrix(1:6, nrow = 2)) #> [1] TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_case_when.html","id":null,"dir":"Reference","previous_headings":"","what":"Results of case_when() as factor. — fct_case_when","title":"Results of case_when() as factor. — fct_case_when","text":"Wrapper dplyr::case_when(), result factor levels order passed .... Returns ordered factor .ordered TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_case_when.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results of case_when() as factor. — fct_case_when","text":"","code":"fct_case_when(..., .ordered = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse factor levels with additional controls — fct_collapse_alt","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"Collapses factor levels manually defined groups like forcats::fct_collapse(), additional options control behavior specified levels exist data order factor levels order listed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"","code":"fct_collapse_alt( .f, ..., other_level = NULL, reorder = TRUE, unknown_levels = c(\"ignore\", \"warn\", \"error\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":".f factor (character vector). ... series named character vectors. levels vector replaced name. other_level Value level used \"\" values named .... NULL, extra level created. reorder TRUE, collapsed levels ordered order listed ..., followed other_level specified, existing levels. unknown_levels handle levels listed ... present input factor .f. Options : \"ignore\": ignore unknown levels without warning (default), \"warn\": issue warning ignore unknown levels, \"error\": raise error.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"factor collapsed levels.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_collapse_alt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse factor levels with additional controls — fct_collapse_alt","text":"","code":"f <- factor(c(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\")) fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\")) #> [1] AB AB c d EFG EFG #> Levels: EFG AB c d fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), reorder = FALSE) #> [1] AB AB c d EFG EFG #> Levels: AB c d EFG fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), other_level = \"other\") #> [1] AB AB other other EFG EFG #> Levels: EFG AB other # `unknown_levels = \"warn\"` mirrors behavior of `forcats::fct_collapse()` # \\donttest{ fct_collapse_alt(f, EFG = c(\"e\", \"f\", \"g\"), AB = c(\"a\", \"b\"), unknown_levels = \"warn\") #> Warning: Unknown levels in `f`: g #> [1] AB AB c d EFG EFG #> Levels: EFG AB c d # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_filter.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter by and drop factor levels simultaneously — fct_filter","title":"Filter by and drop factor levels simultaneously — fct_filter","text":"Filters dataframe specified levels .fct, drops filtered levels .fct.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_filter.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter by and drop factor levels simultaneously — fct_filter","text":"","code":"fct_filter(.data, .fct, .keep = NULL, .drop = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert specified factor levels to NA — fct_na_if","title":"Convert specified factor levels to NA — fct_na_if","text":"Converts specified level(s) factor NA, removing levels factor. differs behavior dplyr::na_if(), (1) replaces values NA retains associated factor level, (2) can replace single value.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert specified factor levels to NA — fct_na_if","text":"","code":"fct_na_if(x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert specified factor levels to NA — fct_na_if","text":"x factor. y character vector levels convert NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert specified factor levels to NA — fct_na_if","text":"input factor specified levels converted NA removed levels.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_na_if.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert specified factor levels to NA — fct_na_if","text":"","code":"f <- factor(c(\"a\", \"b\", \"c\", \"a\")) fct_na_if(f, \"a\") #> [1] b c #> Levels: b c fct_na_if(f, c(\"a\", \"c\")) #> [1] b #> Levels: b # compare `na_if()` dplyr::na_if(f, \"a\") #> [1] b c #> Levels: a b c"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_reorder_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","title":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","text":"Reorders levels .f based variables passed ..., breaking ties using variable order passed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fct_reorder_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reorder factor levels by sorting along multiple other variables. — fct_reorder_n","text":"","code":"fct_reorder_n(.f, ..., .desc = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/filter_drop.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter by and drop a column simultaneously — filter_drop","title":"Filter by and drop a column simultaneously — filter_drop","text":"Filters dataframe specified values .col, drops .col.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/filter_drop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter by and drop a column simultaneously — filter_drop","text":"","code":"filter_drop(.data, .col, .keep = NULL, .drop = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify or remove columns with no data — find_na_cols","title":"Identify or remove columns with no data — find_na_cols","text":"find_na_cols() returns names columns .data values NA. drop_na_cols() returns dataset -NA columns removed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify or remove columns with no data — find_na_cols","text":"","code":"find_na_cols(.data, cols = tidyselect::everything()) drop_na_cols(.data, cols = tidyselect::everything(), quietly = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/find_na_cols.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify or remove columns with no data — find_na_cols","text":".data data frame data frame extension (e.g. tibble). cols Columns check. quietly FALSE, print columns dropped.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine fiscal year from date — fiscal_year","title":"Determine fiscal year from date — fiscal_year","text":"Given date, returns corresponding fiscal year, start date, end date. fiscal_year function allows specifying fiscal year start month, ffy sfy_il convenience wrappers: ffy: Federal fiscal year (starts October) sfy_il: Illinois state fiscal year (starts July)","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine fiscal year from date — fiscal_year","text":"","code":"fiscal_year(x, type = c(\"year\", \"date_first\", \"date_last\"), fiscal_start = 1) ffy(x, type = c(\"year\", \"date_first\", \"date_last\")) sfy_il(x, type = c(\"year\", \"date_first\", \"date_last\"))"},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine fiscal year from date — fiscal_year","text":"x date date-time object. type return: fiscal year (\"year\"), first day fiscal year (\"date_first\"), last day fiscal year (\"date_last\"). fiscal_start fiscal_year, month fiscal year starts (default 1 January).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine fiscal year from date — fiscal_year","text":"integer representing fiscal year Date representing start end fiscal year, depending type.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/fiscal_year.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine fiscal year from date — fiscal_year","text":"","code":"dt <- as.Date(\"2023-08-15\") fiscal_year(dt) #> [1] 2023 fiscal_year(dt, fiscal_start = 7) #> [1] 2024 fiscal_year(dt, type = \"date_first\", fiscal_start = 7) #> [1] \"2023-07-01\" fiscal_year(dt, type = \"date_last\", fiscal_start = 7) #> [1] \"2024-06-30\" ffy(dt) #> [1] 2023 sfy_il(dt) #> [1] 2024"},{"path":"https://ccsarapas.github.io/lighthouse/reference/floor_month.html","id":null,"dir":"Reference","previous_headings":"","what":"Floor methods for date objects — floor_month","title":"Floor methods for date objects — floor_month","text":"floor_month() floor_week() simple wrappers around lubridate::floor_date() round first day month week. floor_days() rounds nearest n-day increment. Floors defined relative earliest date x, unless different start date passed start. Default behavior differs lubridate::floor_date(x, unit = \"{n} days\"), \"resets\" floor first month month. lubridate-like behavior can achieved setting reset_monthly = TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/floor_month.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Floor methods for date objects — floor_month","text":"","code":"floor_month(x) floor_week(x, week_start = getOption(\"lubridate.week.start\", 7)) floor_days(x, n = 1L, start = min(x, na.rm = TRUE), reset_monthly = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":null,"dir":"Reference","previous_headings":"","what":"Missing codes for GAIN ABS — gain_missing_codes","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"Labelled missings used GAIN datasets.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"","code":"gain_missing_codes"},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_missing_codes.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Missing codes for GAIN ABS — gain_missing_codes","text":"named numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_ss_score.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute time period scores for GAIN-SS scales — gain_ss_score","title":"Compute time period scores for GAIN-SS scales — gain_ss_score","text":"Pass scale items .... return columns score lifetime, past year, past 90 days, past month positive items","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/gain_ss_score.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute time period scores for GAIN-SS scales — gain_ss_score","text":"","code":"gain_ss_score(..., .prefix = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/get_col_types.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a dataframe's column types - DEPRECATED — get_col_types","title":"Summarize a dataframe's column types - DEPRECATED — get_col_types","text":"Deprecated favor cols_info(), provides information features stable. Returns class type column .data.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/get_col_types.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a dataframe's column types - DEPRECATED — get_col_types","text":"","code":"get_col_types(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/ggview.html","id":null,"dir":"Reference","previous_headings":"","what":"Nicer ggplot rendering - DEPRECATED — ggview","title":"Nicer ggplot rendering - DEPRECATED — ggview","text":"function deprecated longer maintained. Improvements RStudio graphics make longer needed. Saves ggplot object .svg R temp directory, displays RStudio Viewer pane. Results better image quality Windows machines.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/ggview.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nicer ggplot rendering - DEPRECATED — ggview","text":"","code":"ggview( plot = ggplot2::last_plot(), width = NULL, height = NULL, type = c(\"svg\", \"png\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":null,"dir":"Reference","previous_headings":"","what":"Format and interpolate a string as character vector — glue_chr","title":"Format and interpolate a string as character vector — glue_chr","text":"wrapper around glue::glue() returns character vector rather \"glue\" object.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format and interpolate a string as character vector — glue_chr","text":"","code":"glue_chr(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/glue_chr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format and interpolate a string as character vector — glue_chr","text":"... [expressions] Unnamed arguments taken expression string(s) format. Multiple inputs concatenated together formatting. Named arguments taken temporary variables available substitution.","code":"For `glue_data()`, elements in `...` override the values in `.x`."},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":null,"dir":"Reference","previous_headings":"","what":"Split dataframe by named groups — group_split_named","title":"Split dataframe by named groups — group_split_named","text":"Divides .data named list dataframes defined grouping structure. Grouping variables can optionally passed .... nested list returned one grouping variable .nested = TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split dataframe by named groups — group_split_named","text":"","code":"group_split_named( .data, ..., .keep = TRUE, .sep = \".\", .col_names = FALSE, .col_sep = \"_\", .nested = FALSE, .na.rm = FALSE, .add_groups = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_split_named.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Split dataframe by named groups — group_split_named","text":"","code":"by_cyl_gear1 <- mtcars %>% group_split_named(cyl, gear, .col_names = TRUE) by_cyl_gear1$cyl_6.gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4 by_cyl_gear2 <- mtcars %>% group_split_named(cyl, gear, .col_names = TRUE, .nested = TRUE) by_cyl_gear2$cyl_6 #> $gear_3 #> # A tibble: 2 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 2 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> #> $gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4 #> #> $gear_5 #> # A tibble: 1 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 19.7 6 145 175 3.62 2.77 15.5 0 1 5 6 #> by_cyl_gear2$cyl_6$gear_4 #> # A tibble: 4 × 11 #> mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> 4 17.8 6 168. 123 3.92 3.44 18.9 1 0 4 4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":null,"dir":"Reference","previous_headings":"","what":"Add ","title":"Add ","text":"Groups dataframe columns specified ... using dplyr::group_by(), adds additional group containing observations. Useful including \"total\" \"overall\" row summaries. one column passed ..., \"total\" group combine groups first column passed, unless different column specified .totals_for. Removing changing grouping structure calling group_with_total() aggregating may yield inaccurate results.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add ","text":"","code":"group_with_total( .data, ..., .totals_for = NULL, .label = \"Total\", .add = FALSE, .drop = dplyr::group_by_drop_default(.data), .first_row = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/group_with_total.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add ","text":"","code":"ggplot2::mpg %>% group_with_total(class) %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> # A tibble: 8 × 4 #> class n cty hwy #> #> 1 2seater 5 15.4 24.8 #> 2 compact 47 20.1 28.3 #> 3 midsize 41 18.8 27.3 #> 4 minivan 11 15.8 22.4 #> 5 pickup 33 13 16.9 #> 6 subcompact 35 20.4 28.1 #> 7 suv 62 13.5 18.1 #> 8 Total 234 16.9 23.4 ggplot2::mpg %>% group_with_total(year, drv, .label = \"all years\") %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> `summarise()` has grouped output by 'year'. You can override using the #> `.groups` argument. #> # A tibble: 9 × 5 #> # Groups: year [3] #> year drv n cty hwy #> #> 1 1999 4 49 14.2 18.8 #> 2 1999 f 57 20.0 27.9 #> 3 1999 r 11 14 20.6 #> 4 2008 4 54 14.4 19.5 #> 5 2008 f 49 20.0 28.4 #> 6 2008 r 14 14.1 21.3 #> 7 all years 4 103 14.3 19.2 #> 8 all years f 106 20.0 28.2 #> 9 all years r 25 14.1 21 ggplot2::mpg %>% group_with_total(year, drv, .totals_for = drv) %>% dplyr::summarize(n = dplyr::n(), cty = mean(cty), hwy = mean(hwy)) #> `summarise()` has grouped output by 'year'. You can override using the #> `.groups` argument. #> # A tibble: 8 × 5 #> # Groups: year [2] #> year drv n cty hwy #> #> 1 1999 4 49 14.2 18.8 #> 2 1999 f 57 20.0 27.9 #> 3 1999 r 11 14 20.6 #> 4 1999 Total 117 17.0 23.4 #> 5 2008 4 54 14.4 19.5 #> 6 2008 f 49 20.0 28.4 #> 7 2008 r 14 14.1 21.3 #> 8 2008 Total 117 16.7 23.5"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":null,"dir":"Reference","previous_headings":"","what":"CHS holidays over a 20-year period — holidays_chestnut","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"dataset containing dates Chestnut Health System holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"","code":"holidays_chestnut"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_chestnut.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"CHS holidays over a 20-year period — holidays_chestnut","text":"tibble 140 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":null,"dir":"Reference","previous_headings":"","what":"Illinois state holidays over a 20-year period — holidays_il","title":"Illinois state holidays over a 20-year period — holidays_il","text":"dataset containing dates State Illinois holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Illinois state holidays over a 20-year period — holidays_il","text":"","code":"holidays_il"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_il.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Illinois state holidays over a 20-year period — holidays_il","text":"tibble 252 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":null,"dir":"Reference","previous_headings":"","what":"US federal holidays over a 20-year period — holidays_us","title":"US federal holidays over a 20-year period — holidays_us","text":"dataset containing dates United States federal holidays 2010-12-31 2030-12-31.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US federal holidays over a 20-year period — holidays_us","text":"","code":"holidays_us"},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US federal holidays over a 20-year period — holidays_us","text":"tibble 212 rows 2 variables: Date date holiday observed Holiday holiday name","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/holidays_us.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"US federal holidays over a 20-year period — holidays_us","text":"https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":null,"dir":"Reference","previous_headings":"","what":"Open dataframe in Excel — in_excel","title":"Open dataframe in Excel — in_excel","text":"Saves dataframe .csv R temp directory, opens Excel. .csv randomly-generated name unless otherwise specified name.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open dataframe in Excel — in_excel","text":"","code":"in_excel(df, name, na = \"\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/in_excel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open dataframe in Excel — in_excel","text":"df dataframe open Excel. name (Optional) name use .csv file. provided, random name generated. na (Optional) string use missing values .csv file. Defaults empty string.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":null,"dir":"Reference","previous_headings":"","what":"Vectorized logical tests — is_TRUE","title":"Vectorized logical tests — is_TRUE","text":"is_TRUE() is_FALSE() vectorized versions base::isTRUE() base::isFALSE(), respectively. is_TRUE() returns TRUE vector element evaluates TRUE, FALSE elements (including NAs non-logical values). Useful handling NAs logical tests.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vectorized logical tests — is_TRUE","text":"","code":"is_TRUE(x, strict = TRUE) is_FALSE(x, strict = TRUE) is_TRUE_or_NA(x, strict = TRUE) is_FALSE_or_NA(x, strict = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_TRUE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vectorized logical tests — is_TRUE","text":"x Vector tested strict TRUE (default), numeric character types always return FALSE. FALSE, numeric character vectors can coerced logical (e.g., 1, \"FALSE\") coerced testing.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":null,"dir":"Reference","previous_headings":"","what":"Test for data encoded as other formats — is_coercible_numeric","title":"Test for data encoded as other formats — is_coercible_numeric","text":"Tests whether element vector can coerced another type. See examples.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test for data encoded as other formats — is_coercible_numeric","text":"","code":"is_coercible_numeric(x, all = FALSE, na = c(\"NA\", \"TRUE\")) is_coercible_integer(x, all = FALSE, na = c(\"NA\", \"TRUE\")) is_coercible_logical( x, all = FALSE, na = c(\"NA\", \"TRUE\"), numeric = c(\"binary\", \"any\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test for data encoded as other formats — is_coercible_numeric","text":"x Vector tested TRUE, returns single logical indicating whether every element x coercible. FALSE (default), returns logical vector length x testing element x. na NA values test NA (default) TRUE? numeric is_coercible_logical, numeric value test TRUE, 0 1 (default)?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_coercible_numeric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Test for data encoded as other formats — is_coercible_numeric","text":"","code":"x <- c(\"1\", \"-1.23\", \"$1,234\", NA) is_coercible_numeric(x) #> [1] TRUE TRUE FALSE NA is_coercible_numeric(x, na = \"TRUE\") #> [1] TRUE TRUE FALSE TRUE is_coercible_numeric(x, all = TRUE) #> [1] FALSE is_coercible_integer(x) #> [1] TRUE FALSE FALSE NA y <- c(\"TRUE\", \"T\", \"F\", \"YES\", \"NA\", NA) is_coercible_logical(y) #> [1] TRUE TRUE TRUE FALSE FALSE NA z <- c(0, 1, 2, .1, -1) is_coercible_logical(z) #> [1] TRUE TRUE FALSE FALSE FALSE is_coercible_logical(z, numeric = \"any\") #> [1] TRUE TRUE TRUE TRUE TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify duplicates within a vector or vectors — is_duplicate","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"function checks duplicated values within vector set vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"","code":"is_duplicate(..., nmax = 1, incomparables = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"... one vectors equal length. nmax maximum number times value can appear considered duplicate. incomparables missing values (including NaN) considered duplicates?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"logical vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_duplicate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify duplicates within a vector or vectors — is_duplicate","text":"","code":"x <- c(1, 2, 2, 3, 3, 3) y <- c(1, 1, 2, 1, 2, 2) is_duplicate(x) #> [1] FALSE TRUE TRUE TRUE TRUE TRUE is_duplicate(x, nmax = 2) #> [1] FALSE FALSE FALSE TRUE TRUE TRUE is_duplicate(x, y) #> [1] FALSE FALSE FALSE FALSE TRUE TRUE z <- c(1, NA, NA) is_duplicate(z) #> [1] FALSE FALSE FALSE is_duplicate(z, incomparables = TRUE) #> [1] FALSE TRUE TRUE"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":null,"dir":"Reference","previous_headings":"","what":"Test whether a data frame contains SPSS variable or value labels — is_spss","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"Checks data frame contains SPSS / haven variable labels, value labels, format attributes.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"","code":"is_spss(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":".data data frame.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_spss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test whether a data frame contains SPSS variable or value labels — is_spss","text":"TRUE data frame contains SPSS labels, FALSE otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify non-missing values — is_valid","title":"Identify non-missing values — is_valid","text":"wrapper around !.na(x).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/is_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify non-missing values — is_valid","text":"","code":"is_valid(x) is.valid(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":null,"dir":"Reference","previous_headings":"","what":"Median value as double - DEPRECATED — median_dbl","title":"Median value as double - DEPRECATED — median_dbl","text":"Deprecated lighthouse 0.7.0. main use case function avoid type errors dplyr::if_else() case_when(), longer necessary changes introduced dplyr v1.1.0. Returns median x double vector. Alternative stats::median() consistent return value needed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Median value as double - DEPRECATED — median_dbl","text":"","code":"median_dbl(x, na.rm = FALSE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/median_dbl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Median value as double - DEPRECATED — median_dbl","text":"","code":"if (FALSE) { # \\dontrun{ # stats::median raises error because of inconsistent return types ### note this no longer raises an error with dplyr >= 1.1.0 dplyr::if_else(c(TRUE, FALSE), median(1:4), median(1:5)) # Error in `dplyr::if_else()`: # ! `false` must be a double vector, not an integer vector. # dplyr::if_else(c(TRUE, FALSE), median_dbl(1:4), median_dbl(1:5)) # 2.5 3.0 } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/n_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Count non-missing cases — n_valid","title":"Count non-missing cases — n_valid","text":"n_valid() returns number vector elements NA. returns percentage non-NA values = \"pct\", tibble containing number percentage = \"n_pct\". pct_valid() wrapper around n_valid(= \"pct\"). n_pct_valid() wrapper around n_pct_valid(= \"n_pct\").","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/n_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count non-missing cases — n_valid","text":"","code":"n_valid(x, out = c(\"n\", \"pct\", \"n_pct\"), ...) pct_valid(x, ...) n_pct_valid(x, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Set NA values based on range of numbers. — na_if_range","title":"Set NA values based on range of numbers. — na_if_range","text":"Changes values range range_min range_max NA. Works numeric vectors well numbers character vectors, factor labels, numeric character vectors classes labelled haven_labelled.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set NA values based on range of numbers. — na_if_range","text":"","code":"na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'numeric' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'character' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'factor' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'labelled' na_if_range(x, range_min = -Inf, range_max = -1) # S3 method for class 'haven_labelled' na_if_range(x, range_min = -Inf, range_max = -1) coerce_na_range(x, range_min = -Inf, range_max = -1)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set NA values based on range of numbers. — na_if_range","text":"x numeric vector, character vector, factor. range_min minimum value set NA. Defaults -Inf. range_max maximum value set NA. Defaults -1.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_if_range.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set NA values based on range of numbers. — na_if_range","text":"Previously known coerce_na_range, retained alias backward compatibility.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_like.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate NA values of appropriate type - DEPRECATED — na_like","title":"Generate NA values of appropriate type - DEPRECATED — na_like","text":"function deprecated lighthouse 0.7.0 (1) always buggy (2) main purpose pass appropriate NAs dplyr::if_else() case_when(), longer necessary changes introduced dplyr v1.1.0 Returns compatible NA based x. usually type x (e.g., NA_real_ x double vector). x factor, return NA_character_ factor_as_character = TRUE (default) NA_integer_ otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_like.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate NA values of appropriate type - DEPRECATED — na_like","text":"","code":"na_like(x, factor_as_character = TRUE, match_length = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_to_null.html","id":null,"dir":"Reference","previous_headings":"","what":"Replace NA with NULL and vice versa — na_to_null","title":"Replace NA with NULL and vice versa — na_to_null","text":"na_to_null() Replaces NAs vector list NULL. Can useful lists function arguments (e.g., using purrr::pmap()). null_to_na() Replaces NULLs list NAs. Returns atomic vector unlist = TRUE list otherwise.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/na_to_null.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replace NA with NULL and vice versa — na_to_null","text":"","code":"na_to_null(x) null_to_na(x, unlist = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":null,"dir":"Reference","previous_headings":"","what":"Match values not in vector — not-in","title":"Match values not in vector — not-in","text":"Infix operator returning TRUE elements left operand (lhs) found right operand (rhs). Equivalent !(lhs %% rhs).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Match values not in vector — not-in","text":"","code":"lhs %!in% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/not-in.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Match values not in vector — not-in","text":"","code":"\"April\" %!in% month.name #> [1] FALSE \"Junvember\" %!in% month.name #> [1] TRUE some_letters <- sample(letters, 10) letters[letters %in% some_letters] #> [1] \"c\" \"d\" \"e\" \"k\" \"n\" \"o\" \"q\" \"t\" \"v\" \"y\" letters[letters %!in% some_letters] #> [1] \"a\" \"b\" \"f\" \"g\" \"h\" \"i\" \"j\" \"l\" \"m\" \"p\" \"r\" \"s\" \"u\" \"w\" \"x\" \"z\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the nth, first, or last non-NA value in a vector — nth_valid","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"functions retrieve nth, first last non-NA value vector. fewer n non-NA values, default value can returned.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"","code":"nth_valid(x, n, default = NA) first_valid(x, default = NA) last_valid(x, default = NA)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"x vector. n integer. Position non-NA value return. Negative values start end vector. default default value use fewer n non-NA values x. cast type x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"nth_valid: nth non-NA value x. first_valid: first non-NA value x. last_valid: last non-NA value x.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/nth_valid.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the nth, first, or last non-NA value in a vector — nth_valid","text":"","code":"x <- c(NA, 7, NA, 5, 4, NA, 2, NA) first_valid(x) #> [1] 7 last_valid(x) #> [1] 2 nth_valid(x, 2) #> [1] 5 nth_valid(x, -2) #> [1] 4 nth_valid(x, 6) #> [1] NA nth_valid(x, 6, default = -Inf) #> [1] -Inf"},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate colors before and after alpha blending — opacity","title":"Translate colors before and after alpha blending — opacity","text":"functions translate colors original RGB values RGB values alpha blending background color. before_opacity calculates original color given blended color, after_opacity calculates blended color given original color.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate colors before and after alpha blending — opacity","text":"","code":"after_opacity(color, alpha, bg = \"white\") before_opacity(color, alpha, bg = \"white\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate colors before and after alpha blending — opacity","text":"color starting color color name, hex code, RGB triplet. alpha opacity foreground color, number 0 1. bg background color blending, color name, hex code, RGB triplet. Defaults \"white\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate colors before and after alpha blending — opacity","text":"before_opacity: original color alpha blending, hex code. after_opacity: blended color alpha blending, hex code.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/opacity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate colors before and after alpha blending — opacity","text":"","code":"red <- \"red\" red_50 <- after_opacity(red, 0.5) red_back <- before_opacity(red_50, 0.5) scales::show_col(c(red, red_50, red_back), ncol = 3) color_blends <- sapply( c(\"red\", \"blue\", \"yellow\", \"white\", \"black\", \"gray50\"), after_opacity, color = \"red\", alpha = 0.5 ) scales::show_col(color_blends)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Open a file or directory — open_file","title":"Open a file or directory — open_file","text":"Functions open file default program open file's location file explorer.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Open a file or directory — open_file","text":"","code":"open_file(path) open_location(path) file.open(path) dir.open(path)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Open a file or directory — open_file","text":"path path file directory.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Open a file or directory — open_file","text":"file.open() dir.open() aliases, line base::file.create, file.exists, dir.create, dir.exists, etc.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Open a file or directory — open_file","text":"open_file(): Opens file specified path using default program file type. Automatically handles paths special characters. open_location(): Opens file explorer location specified file, file selected possible. Automatically handles paths special characters.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/open_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Open a file or directory — open_file","text":"","code":"if (FALSE) { # \\dontrun{ # Open a file open_file(\"path/to/file.txt\") # Open a file's location open_location(\"path/to/file.txt\") } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert between probabilities and odds ratios — p_to_OR","title":"Convert between probabilities and odds ratios — p_to_OR","text":"functions convert probabilities odds ratios. p_to_OR calculates odds ratio given two probabilities, OR_to_p2 OR_to_p1 calculate second first probability, respectively, given probability odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert between probabilities and odds ratios — p_to_OR","text":"","code":"p_to_OR(p1, p2) OR_to_p2(p1, OR) OR_to_p1(p2, OR)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert between probabilities and odds ratios — p_to_OR","text":"p1 first probability. p2 second probability. odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert between probabilities and odds ratios — p_to_OR","text":"p_to_OR: odds ratio corresponding given probabilities. OR_to_p2: second probability corresponding given first probability odds ratio. OR_to_p1: first probability corresponding given second probability odds ratio.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/p_to_OR.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert between probabilities and odds ratios — p_to_OR","text":"","code":"p_to_OR(0.4, 0.6) #> [1] 2.25 OR_to_p2(0.4, 2.25) #> [1] 0.6 OR_to_p1(0.6, 2.25) #> [1] 0.4"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":null,"dir":"Reference","previous_headings":"","what":"Pad vectors to the same length — pad_vectors","title":"Pad vectors to the same length — pad_vectors","text":"function takes one vectors pads NA values length longest vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pad vectors to the same length — pad_vectors","text":"","code":"pad_vectors(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pad vectors to the same length — pad_vectors","text":"... One vectors.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pad vectors to the same length — pad_vectors","text":"list vectors, length longest input vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pad_vectors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pad vectors to the same length — pad_vectors","text":"","code":"pad_vectors(1:3, 1:5, 1:4) #> [[1]] #> [1] 1 2 3 NA NA #> #> [[2]] #> [1] 1 2 3 4 5 #> #> [[3]] #> [1] 1 2 3 4 NA #> # supports list unpacking with `!!!` operator pad_vectors(!!!list(1:3, 1:5, 1:4)) #> [[1]] #> [1] 1 2 3 NA NA #> #> [[2]] #> [1] 1 2 3 4 5 #> #> [[3]] #> [1] 1 2 3 4 NA #> # one use case is assembling vectors of different lengths into a dataframe # for example, to see unique column values at a glance: unique_vals <- dplyr::starwars %>% dplyr::select(hair_color:eye_color) %>% lapply(unique) pad_vectors(!!!unique_vals) %>% as.data.frame() #> hair_color skin_color eye_color #> 1 blond fair blue #> 2 gold yellow #> 3 none white, blue red #> 4 brown white brown #> 5 brown, grey light blue-gray #> 6 black white, red black #> 7 auburn, white unknown orange #> 8 auburn, grey green hazel #> 9 white green-tan, brown pink #> 10 grey pale unknown #> 11 auburn metal red, blue #> 12 blonde dark gold #> 13 brown mottle green, yellow #> 14 brown white #> 15 grey dark #> 16 mottled green #> 17 orange #> 18 blue, grey #> 19 grey, red #> 20 red #> 21 blue #> 22 grey, blue #> 23 grey, green, yellow #> 24 yellow #> 25 tan #> 26 fair, green, yellow #> 27 silver, red #> 28 green, grey #> 29 red, blue, white #> 30 brown, white #> 31 none "},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":null,"dir":"Reference","previous_headings":"","what":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"Note 2024, pivot_wider_alt()'s functionality now supported tidyr::pivot_wider(). particular, functionality names_value_first = TRUE pivot_wider_alt() can now achieved using names_vary = \"slowest\" pivot_wider(). functionality names_value_sep can achieved using names_glue argument pivot_wider(). wrapper around tidyr::pivot_wider() additional options sorting naming output columns, arguments sort_by_col, names_value_first, names_value_sep options relevant one input column passed values_from.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"","code":"pivot_wider_alt( data, id_cols = NULL, names_from = name, sort_by_col = TRUE, names_value_first = TRUE, names_value_sep = \".\", names_sep = \"_\", names_prefix = \"\", names_glue = NULL, names_repair = \"check_unique\", values_from = value, values_fill = NULL, values_fn = NULL )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"data data frame pivot. id_cols set columns uniquely identify observation. Typically used redundant variables, .e. variables whose values perfectly correlated existing variables. Defaults columns data except columns specified names_from values_from. tidyselect expression supplied, evaluated data removing columns specified names_from values_from. sort_by_col TRUE (default), output columns sorted names_from, values_from. (Differs tidyr::pivot_wider(), sorts values_from first, names_from.) names_value_first FALSE, output columns named using {column}_{.value} scheme. (Differs tidyr::pivot_wider(), uses {.value}_{column} scheme.) names_value_sep, names_sep names_from values_from contain multiple variables, used join values together single string use column name. names_value_sep separate {.value} {column} components, names_sep separate {column} components one another names_from contains multiple variables. See Details Examples. names_prefix, names_glue, names_repair, values_from, values_fill, values_fn See documentation tidyr::pivot_wider().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"#' names_value_sep argument allows output column names use different separator {.value} {column} multiple {columns}s. Example:","code":"pivot_wider_alt( fakedata, names_from = c(size, color), # size = \"sm\", \"med\", \"lg\"; color = \"red\", \"blue\" values_from = c(n, weight), names_sep = \"_\", names_value_sep = \": \" ) # output column names: # `n: sm_red`, `weight: sm_red`, `n: sm_blue`, `weight: sm_blue`, `n: med_red`..."},{"path":"https://ccsarapas.github.io/lighthouse/reference/pivot_wider_alt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Alternative column ordering and naming for pivot_wider() — pivot_wider_alt","text":"","code":"data_ex <- ggplot2::diamonds %>% dplyr::group_by(cut, color) %>% dplyr::summarize(Min = min(price), Median = median(price), Max = max(price)) #> `summarise()` has grouped output by 'cut'. You can override using the `.groups` #> argument. # default pivot_wider() behavior data_ex %>% tidyr::pivot_wider( id_cols = color, names_from = cut, values_from = Min:Max ) #> # A tibble: 7 × 16 #> color Min_Fair Min_Good `Min_Very Good` Min_Premium Min_Ideal Median_Fair #> #> 1 D 536 361 357 367 367 3730 #> 2 E 337 327 352 326 326 2956 #> 3 F 496 357 357 342 408 3035 #> 4 G 369 394 354 382 361 3057 #> 5 H 659 368 337 368 357 3816 #> 6 I 735 351 336 334 348 3246 #> 7 J 416 335 336 363 340 3302 #> # ℹ 9 more variables: Median_Good , `Median_Very Good` , #> # Median_Premium , Median_Ideal , Max_Fair , Max_Good , #> # `Max_Very Good` , Max_Premium , Max_Ideal # pivot_wider_alt() behavior data_ex %>% pivot_wider_alt( id_cols = color, names_from = cut, values_from = Min:Max ) #> # A tibble: 7 × 16 #> color Min.Fair Median.Fair Max.Fair Min.Good Median.Good Max.Good #> #> 1 D 536 3730 16386 361 2728. 18468 #> 2 E 337 2956 15584 327 2420 18236 #> 3 F 496 3035 17995 357 2647 18686 #> 4 G 369 3057 18574 394 3340 18788 #> 5 H 659 3816 18565 368 3468. 18640 #> 6 I 735 3246 18242 351 3640. 18707 #> 7 J 416 3302 18531 335 3733 18325 #> # ℹ 9 more variables: `Min.Very Good` , `Median.Very Good` , #> # `Max.Very Good` , Min.Premium , Median.Premium , #> # Max.Premium , Min.Ideal , Median.Ideal , Max.Ideal # with `names_value_first` = FALSE data_ex %>% pivot_wider_alt( id_cols = color, names_from = cut, values_from = Min:Max, names_value_first = FALSE ) #> # A tibble: 7 × 16 #> color Fair.Min Fair.Median Fair.Max Good.Min Good.Median Good.Max #> #> 1 D 536 3730 16386 361 2728. 18468 #> 2 E 337 2956 15584 327 2420 18236 #> 3 F 496 3035 17995 357 2647 18686 #> 4 G 369 3057 18574 394 3340 18788 #> 5 H 659 3816 18565 368 3468. 18640 #> 6 I 735 3246 18242 351 3640. 18707 #> 7 J 416 3302 18531 335 3733 18325 #> # ℹ 9 more variables: `Very Good.Min` , `Very Good.Median` , #> # `Very Good.Max` , Premium.Min , Premium.Median , #> # Premium.Max , Ideal.Min , Ideal.Median , Ideal.Max # multiple `names_from` vars, with different value vs. name separators ggplot2::mpg %>% dplyr::filter(class %in% c(\"compact\", \"subcompact\", \"midsize\")) %>% dplyr::group_by( manufacturer, trans = stringr::str_extract(trans, \".*(?=\\\\()\"), year ) %>% dplyr::summarize(across(c(cty, hwy), mean)) %>% pivot_wider_alt( names_from = trans:year, values_from = cty:hwy, names_sep = \"_\", names_value_sep = \": \" ) #> `summarise()` has grouped output by 'manufacturer', 'trans'. You can override #> using the `.groups` argument. #> # A tibble: 10 × 9 #> # Groups: manufacturer [10] #> manufacturer `cty: auto_1999` `hwy: auto_1999` `cty: auto_2008` #> #> 1 audi 16 25.8 18 #> 2 chevrolet 18.5 26.5 19 #> 3 ford 16.5 23 15.5 #> 4 honda 24 32 24.5 #> 5 hyundai 18.3 26 19.2 #> 6 nissan 18.5 26.5 20.3 #> 7 pontiac 17 26.3 17 #> 8 subaru 20 26 20 #> 9 toyota 21 28.2 21.2 #> 10 volkswagen 19.4 28.1 20.2 #> # ℹ 5 more variables: `hwy: auto_2008` , `cty: manual_1999` , #> # `hwy: manual_1999` , `cty: manual_2008` , #> # `hwy: manual_2008` "},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":null,"dir":"Reference","previous_headings":"","what":"tidyselect-friendly parallel minima and maxima — pminmax_across","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"Wrappers around base::pmin() base::pmax() accept expressions.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"","code":"pmax_across(cols, na.rm = FALSE) pmin_across(cols, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/pminmax_across.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"tidyselect-friendly parallel minima and maxima — pminmax_across","text":"","code":"# using `base::pmax()` mtcars %>% dplyr::mutate( max_val = pmax(mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb) ) #> mpg cyl disp hp drat wt qsec vs am gear carb max_val #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 160.0 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 160.0 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 108.0 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 258.0 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 360.0 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 225.0 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 360.0 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 146.7 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 140.8 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 167.6 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 167.6 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 275.8 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 275.8 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 275.8 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 472.0 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 460.0 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 440.0 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 78.7 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 75.7 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 71.1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 120.1 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 318.0 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 304.0 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 350.0 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 400.0 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 79.0 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 120.3 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 113.0 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 351.0 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 175.0 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 335.0 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 121.0 # using `pmax_across()` mtcars %>% dplyr::mutate(max_val = pmax_across(mpg:carb)) #> mpg cyl disp hp drat wt qsec vs am gear carb max_val #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 160.0 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 160.0 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 108.0 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 258.0 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 360.0 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 225.0 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 360.0 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 146.7 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 140.8 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 167.6 #> Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 167.6 #> Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 275.8 #> Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 275.8 #> Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 275.8 #> Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 472.0 #> Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 460.0 #> Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 440.0 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 78.7 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 75.7 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 71.1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 120.1 #> Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 318.0 #> AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 304.0 #> Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 350.0 #> Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 400.0 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 79.0 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 120.3 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 113.0 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 351.0 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 175.0 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 335.0 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 121.0"},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_all.html","id":null,"dir":"Reference","previous_headings":"","what":"Print all tibble rows — print_all","title":"Print all tibble rows — print_all","text":"Actually limits printing RStudioPreference \"console_max_lines\" (1000 lines running RStudio) unless otherwise specified max. Works tibbles, base::data.frames.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_all.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print all tibble rows — print_all","text":"","code":"print_all(x, ..., max = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Print specified number of tibble rows — print_n","title":"Print specified number of tibble rows — print_n","text":"Print specified number tibble rows","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/print_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print specified number of tibble rows — print_n","text":"","code":"print_n(x, n, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/rbool.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate random logicals — rbool","title":"Generate random logicals — rbool","text":"Returns vector random logicals length n, drawn binomial distribution trial probability prob (default = .5).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/rbool.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate random logicals — rbool","text":"","code":"rbool(n, prob = 0.5)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. magrittr %>% scales comma, percent","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reorder_dendro_by_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Reorder a dendrogram — reorder_dendro_by_label","title":"Reorder a dendrogram — reorder_dendro_by_label","text":"Reorders dendrogram leaves based vector labels passed .order.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reorder_dendro_by_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reorder a dendrogram — reorder_dendro_by_label","text":"","code":"reorder_dendro_by_label(.dendro, .order, agglo.FUN = max)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/rev_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Reverse the order of rows in a table. — rev_rows","title":"Reverse the order of rows in a table. — rev_rows","text":"Reverse order rows table.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/rev_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reverse the order of rows in a table. — rev_rows","text":"","code":"rev_rows(.data)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Reverse key a numeric vector — reverse_key","title":"Reverse key a numeric vector — reverse_key","text":"Reverses numeric vector x subtracting min adding max. Observed minimum maximum x used unless otherwise specified.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reverse key a numeric vector — reverse_key","text":"","code":"reverse_key(x, na.rm = FALSE, max = NULL, min = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/reverse_key.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Reverse key a numeric vector — reverse_key","text":"","code":"reverse_key(1:5) #> [1] 5 4 3 2 1 reverse_key(3:5) #> [1] 5 4 3 reverse_key(3:5, min = 1, max = 5) #> [1] 3 2 1"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":null,"dir":"Reference","previous_headings":"","what":"Row sums for selected columns with NA handling — row_sums_across","title":"Row sums for selected columns with NA handling — row_sums_across","text":"function calculates row sums selected columns using tidyselect expressions. Unlike rowSums, returns NA rather 0 na.rm = TRUE selected columns NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Row sums for selected columns with NA handling — row_sums_across","text":"","code":"row_sums_across(cols, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Row sums for selected columns with NA handling — row_sums_across","text":"cols columns sum across. na.rm missing values (including NaN) removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_across.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Row sums for selected columns with NA handling — row_sums_across","text":"","code":"df <- tibble::tibble( x = c(1, 2, NA, NA), y = c(5, NA, 7, NA), z = c(9, 10, 11, NA) ) df %>% dplyr::mutate( row_sums = row_sums_across(x:z), row_sums_na.rm = row_sums_across(x:z, na.rm = TRUE) ) #> # A tibble: 4 × 5 #> x y z row_sums row_sums_na.rm #> #> 1 1 5 9 15 15 #> 2 2 NA 10 NA 12 #> 3 NA 7 11 NA 18 #> 4 NA NA NA NA NA"},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_spss.html","id":null,"dir":"Reference","previous_headings":"","what":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","title":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","text":"Deprecated lighthouse 0.7.0 favor row_sums_across(), provides information features stable. Sums across columns la SPSS: NAs counted 0s, variables NA, result NA.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/row_sums_spss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Replicate SPSS SUM() function - DEPRECATED — row_sums_spss","text":"","code":"row_sums_spss(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/safe_minmax.html","id":null,"dir":"Reference","previous_headings":"","what":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","title":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","text":"Deprecated lighthouse 0.7.0 favor max_if_any() min_if_any(), now call.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/safe_minmax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Maxima and minima with alternative missing value handling - DEPRECATED — safe_minmax","text":"","code":"safe_max(..., na.rm = TRUE) safe_min(..., na.rm = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_mad.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale based on median absolute deviation — scale_mad","title":"Scale based on median absolute deviation — scale_mad","text":"Scales vector values based median absolute deviation. Values may centered around median (default), mean, centered. Compare base::scale(), uses standard deviation centers around mean default.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_mad.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale based on median absolute deviation — scale_mad","text":"","code":"scale_mad(x, center = c(\"median\", \"mean\", \"none\"), mad_constant = 1.4826)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":null,"dir":"Reference","previous_headings":"","what":"Scaling and centering of vectors — scale_vec","title":"Scaling and centering of vectors — scale_vec","text":"wrapper around base::scale() returns vector instead matrix.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scaling and centering of vectors — scale_vec","text":"","code":"scale_vec(x, center = TRUE, scale = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/scale_vec.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scaling and centering of vectors — scale_vec","text":"","code":"# using base::scale() scale(0:4) #> [,1] #> [1,] -1.2649111 #> [2,] -0.6324555 #> [3,] 0.0000000 #> [4,] 0.6324555 #> [5,] 1.2649111 #> attr(,\"scaled:center\") #> [1] 2 #> attr(,\"scaled:scale\") #> [1] 1.581139 # using scale_vec() scale_vec(0:4) #> [1] -1.2649111 -0.6324555 0.0000000 0.6324555 1.2649111"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error - DEPRECATED — se","title":"Compute the standard error - DEPRECATED — se","text":"Deprecated 0.7.0 favor specific functions se_mean() se_mean(). se() now calls se_mean() deprecation warning. Computes standard error values x.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error - DEPRECATED — se","text":"","code":"se(x, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error - DEPRECATED — se","text":"x numeric vector non-factor object coercible numeric .double(x). na.rm logical. missing values removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error of the mean — se_mean","title":"Compute the standard error of the mean — se_mean","text":"Computes standard error mean numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error of the mean — se_mean","text":"","code":"se_mean(x, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_mean.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error of the mean — se_mean","text":"x numeric vector non-factor object coercible numeric .double(x). na.rm logical. missing values removed?","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the standard error of a proportion — se_prop","title":"Compute the standard error of a proportion — se_prop","text":"Computes standard error proportion logical numeric vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the standard error of a proportion — se_prop","text":"","code":"se_prop( x, na.rm = FALSE, min_var = 5, low_var_action = c(\"warn\", \"ignore\", \"error\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the standard error of a proportion — se_prop","text":"x logical numeric vector. numeric, must include 0s, 1s, /NAs. na.rm logical. missing values removed? min_var numeric. Minimum variance (n * p * (1 - p)) valid normal approximation binomial. See Details. low_var_action character. Action take variance min_var.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/se_prop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the standard error of a proportion — se_prop","text":"Standard error proportion calculated using formula: $$SE = \\sqrt{\\frac{p(1 - p)}{n}}$$ formula assumes binomial sampling distribution underlying observed proportion can approximated normal distribution. assumption valid proportion variance (np(1 - p)) sufficiently large, may hold variance lower. se_prop() therefore issues warning variance less 5; behavior can overridden using min_var low_var_action arguments.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":null,"dir":"Reference","previous_headings":"","what":"Set comparison with automatic naming — set_compare","title":"Set comparison with automatic naming — set_compare","text":"Compares two sets (vectors), returning elements unique elements common. Optionally names returned sets based supplied object names.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set comparison with automatic naming — set_compare","text":"","code":"set_compare(x, y, autoname = TRUE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set comparison with automatic naming — set_compare","text":"x vector representing first set. y vector representing second set. autoname Logical, whether automatically name returned sets based supplied object names. Defaults TRUE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set comparison with automatic naming — set_compare","text":"named list three elements: Elements unique x Elements unique y Elements common x y","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_compare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set comparison with automatic naming — set_compare","text":"","code":"v1 <- c(1, 2, 3, 4) v2 <- c(3, 4, 5, 6) set_compare(v1, v2) #> $v1 #> [1] 1 2 #> #> $v2 #> [1] 5 6 #> #> $intersect #> [1] 3 4 #> set_compare(v1, v2, autoname = FALSE) #> $x #> [1] 1 2 #> #> $y #> [1] 5 6 #> #> $intersect #> [1] 3 4 #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"Changes default theme color scales ggplot2.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"","code":"set_ggplot_opts(base_theme = NULL, brewer_pal_discrete = \"Set1\", ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/set_ggplot_opts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Nicer default theme and palettes for ggplot2 — set_ggplot_opts","text":"Theme based hrbrthemes::theme_ipsum_rc(), unless otherwise specified base_theme argument. theme modified follows: Axis titles centered Legend title omitted Minor gridlines omitted Facet labels placed outside axes Various tweaks text size margins Default color fill palettes set based scale type: discrete scales, RColorBrewer palette \"Set1,\" unless otherwise specified brewer_pal_discrete argument continuous binned scales, RColorBrewer palette \"Blues\" ordinal scales, viridisLite palette \"viridis\" Default font family geom_text() geom_label() set match base_theme.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":null,"dir":"Reference","previous_headings":"","what":"Concatenate strings with NA handling — str_c_narm","title":"Concatenate strings with NA handling — str_c_narm","text":"str_c_narm concatenates strings similar base::paste() stringr::str_c(), different NA handling. NAs dropped row-wise prior concatenation. See Details Examples.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Concatenate strings with NA handling — str_c_narm","text":"","code":"str_c_narm( ..., sep = \"\", collapse = NULL, if_all_na = c(\"empty\", \"NA\", \"remove\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Concatenate strings with NA handling — str_c_narm","text":"... character vectors vectors coercible character. May also single data frame (accommodate dplyr::across() pick()). sep separator insert input vectors. collapse optional character string combine results single string. if_all_na values row NA: \"empty\": (default) returns empty string. \"NA\": returns NA. \"remove\": removes row output.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Concatenate strings with NA handling — str_c_narm","text":"character vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Concatenate strings with NA handling — str_c_narm","text":"str_c_narm() provides alternative missing value handling compared base::paste() stringr::str_c(). Given vectors missing values: paste() paste0() convert NAs string \"NA\" concatenating: ...stringr::str_c returns NA value row NA: contrast, str_c_narm() removes NAs row concatenating: ...options case values row NA:","code":"#> (dat <- tibble::tibble(v1 = c(\"a1\", \"b1\", \"c1\", NA), v2 = c(\"a2\", NA, \"c2\", NA), v3 = c(\"a3\", \"b3\", NA, NA))) # A tibble: 4 × 3 v1 v2 v3 1 a1 a2 a3 2 b1 NA b3 3 c1 c2 NA 4 NA NA NA #> dplyr::mutate(dat, paste = paste(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 paste 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 b1 | NA | b3 3 c1 c2 NA c1 | c2 | NA 4 NA NA NA NA | NA | NA #> dplyr::mutate(dat, str_c = stringr::str_c(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 str_c 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 NA 3 c1 c2 NA NA 4 NA NA NA NA #> dplyr::mutate(dat, str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \")) # A tibble: 4 × 4 v1 v2 v3 str_c_narm 1 a1 a2 a3 \"a1 | a2 | a3\" 2 b1 NA b3 \"b1 | b3\" 3 c1 c2 NA \"c1 | c2\" 4 NA NA NA \"\" #> dplyr::mutate(dat, str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \", if_all_na = \"NA\")) # A tibble: 4 × 4 v1 v2 v3 str_c_narm 1 a1 a2 a3 a1 | a2 | a3 2 b1 NA b3 b1 | b3 3 c1 c2 NA c1 | c2 4 NA NA NA NA"},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_narm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Concatenate strings with NA handling — str_c_narm","text":"","code":"str_c_narm(c(\"a\", NA), c(\"b\", \"c\"), sep = \"_\") #> [1] \"a_b\" \"c\" str_c_narm(c(\"a\", NA), c(\"b\", NA), if_all_na = \"NA\") #> [1] \"ab\" NA # compare behavior to `paste()` and `str_c()` dat <- tibble::tibble(v1 = c(\"a1\", \"b1\", \"c1\", NA), v2 = c(\"a2\", NA, \"c2\", NA), v3 = c(\"a3\", \"b3\", NA, NA)) dplyr::mutate( dat, paste = paste(v1, v2, v3, sep = \" | \"), str_c = stringr::str_c(v1, v2, v3, sep = \" | \"), str_c_narm = str_c_narm(v1, v2, v3, sep = \" | \") ) #> # A tibble: 4 × 6 #> v1 v2 v3 paste str_c str_c_narm #> #> 1 a1 a2 a3 a1 | a2 | a3 a1 | a2 | a3 \"a1 | a2 | a3\" #> 2 b1 NA b3 b1 | NA | b3 NA \"b1 | b3\" #> 3 c1 c2 NA c1 | c2 | NA NA \"c1 | c2\" #> 4 NA NA NA NA | NA | NA NA \"\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy string concatenation — str_c_tidy","title":"Tidy string concatenation — str_c_tidy","text":"function performs tidyverse-friendly string concatenation. takes data frame tibble selection columns, concatenates string values row, returns concatenated strings vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy string concatenation — str_c_tidy","text":"","code":"str_c_tidy( ..., sep = \"\", collapse = NULL, na.rm = FALSE, if_all_na = c(\"empty\", \"NA\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy string concatenation — str_c_tidy","text":"... tidyselect expression indicating character columns vectors columns coercible character. sep separator insert input vectors. collapse optional character string combine results single string. na.rm logical. Remove missing values concatenating? Treatment NAs similar str_c_narm() differs behavior paste() stringr::str_c(). See Details str_c_narm(). if_all_na na.rm = TRUE values row NA. \"empty\", default, returns empty string. \"NA\" returns NA. Ignored na.rm = FALSE.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy string concatenation — str_c_tidy","text":"character vector.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_c_tidy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy string concatenation — str_c_tidy","text":"","code":"df <- tibble::tribble( ~x, ~y, ~z, \"a\", \"b\", \"c\", \"d\", NA, \"f\", \"g\", \"h\", NA ) df %>% dplyr::mutate(combined = str_c_tidy(x:z)) #> # A tibble: 3 × 4 #> x y z combined #> #> 1 a b c abc #> 2 d NA f NA #> 3 g h NA NA df %>% dplyr::mutate(combined = str_c_tidy(x:z, na.rm = TRUE)) #> # A tibble: 3 × 4 #> x y z combined #> #> 1 a b c abc #> 2 d NA f df #> 3 g h NA gh"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":null,"dir":"Reference","previous_headings":"","what":"Collapse a character vector into a single string — str_collapse","title":"Collapse a character vector into a single string — str_collapse","text":"Concatenates elements character vector. Essentially column-wise variant dplyr::str_c(). Can accept multiple character vectors, returned separate character strings join = NULL (default), concatenated separator supplied join.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collapse a character vector into a single string — str_collapse","text":"","code":"str_collapse(..., sep = \"\", join = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collapse a character vector into a single string — str_collapse","text":"... one character vectors sep string insert elements input vector join optional string combine output single string. join multiple collapsed vectors. NULL (default), returns character vector input vector collapsed separately.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Collapse a character vector into a single string — str_collapse","text":"join NULL, returns character vector length equal number vectors passed .... join provided, returns character vector length 1.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Collapse a character vector into a single string — str_collapse","text":"single character vector passed ..., behavior similar stringr::str_c() using collapse argument. behavior differs multiple vectors passed ... – see examples. difference arise str_collapse() first collapses vector, optionally joins resulting vectors, whereas stringr::str_c() first joins across vectors collapsing resulting vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_collapse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collapse a character vector into a single string — str_collapse","text":"","code":"# with just a single character vector, behavior is similar to `stringr::str_c()` # with the `collapse` argument abc <- c(\"a\", \"b\", \"c\") str_collapse(abc, sep = \"-\") #> [1] \"a-b-c\" stringr::str_c(abc, collapse = \"-\") #> [1] \"a-b-c\" # but behavior differs when multiple vectors are passed def <- c(\"d\", \"e\", \"f\") str_collapse(abc, def, sep = \"-\") #> [1] \"a-b-c\" \"d-e-f\" stringr::str_c(abc, def, collapse = \"-\") #> [1] \"ad-be-cf\" str_collapse(abc, def, sep = \"-\", join = \" | \") #> [1] \"a-b-c | d-e-f\" stringr::str_c(abc, def, collapse = \"-\", sep = \" | \") #> [1] \"a | d-b | e-c | f\" stringr::str_c(abc, def, sep = \"-\", collapse = \" | \") #> [1] \"a-d | b-e | c-f\" # can accept vectors of different lengths lmnop <- c(\"l\", \"m\", \"n\", \"o\", \"p\") str_collapse(abc, def, lmnop, join = \", \") #> [1] \"abc, def, lmnop\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":null,"dir":"Reference","previous_headings":"","what":"Detect the presence of any pattern in a string — str_detect_any","title":"Detect the presence of any pattern in a string — str_detect_any","text":"str_detect_any() returns TRUE element patterns present string. str_starts_any() str_ends_any() match beginning end strings.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Detect the presence of any pattern in a string — str_detect_any","text":"","code":"str_detect_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE ) str_starts_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE ) str_ends_any( string, patterns, whole_word = FALSE, ignore_case = FALSE, negate = FALSE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_detect_any.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Detect the presence of any pattern in a string — str_detect_any","text":"string character vector something coercible one. patterns character vector containing regular expressions look . whole_word logical. Match whole words string (defined \"\\\\b\" word boundary)? ignore_case logical. Ignore case matching patterns string? negate Logical. TRUE, inverts resulting boolean vector.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":null,"dir":"Reference","previous_headings":"","what":"Find common prefixes or suffixes — str_prefix","title":"Find common prefixes or suffixes — str_prefix","text":"Returns substring beginnings endings common elements vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find common prefixes or suffixes — str_prefix","text":"","code":"str_prefix(string, na.rm = FALSE) str_suffix(string, na.rm = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/str_prefix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Find common prefixes or suffixes — str_prefix","text":"","code":"test_words <- c(\"antidote\", \"antimony\", \"antimatter\", \"antisense\") str_prefix(test_words) #> [1] \"anti\" wdays <- c( \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ) str_suffix(wdays) #> [1] \"day\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":null,"dir":"Reference","previous_headings":"","what":"Format date-time to string without leading zeros — strftime_no_lead","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"Converts date-time object character string without leading zeros numeric components. Wraps format.POSIXlt(), removing leading zeros using regex substitution.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"","code":"strftime_no_lead(x, format = \"%m/%d/%Y\", tz = \"\", usetz = FALSE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"x date-time object. format character string giving date-time format used strftime(). tz character string specifying time zone used. usetz logical value indicating whether time zone abbreviation appended output. ... arguments passed format.POSIXlt().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"character vector representing date-time without leading zeros.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/strftime_no_lead.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format date-time to string without leading zeros — strftime_no_lead","text":"","code":"dt <- as.POSIXct(\"2023-06-05 01:02:03\") # With leading zeros format(dt, \"%m/%d/%Y %H:%M:%S\") #> [1] \"06/05/2023 01:02:03\" # Without leading zeros strftime_no_lead(dt, \"%m/%d/%Y %H:%M:%S\") #> [1] \"6/5/2023 1:2:3\""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize variables based on measurement level — summary_report","title":"Summarize variables based on measurement level — summary_report","text":"Summarizes variable passed .... handled differently based variable's level measurement: nominal variables, returns n proportion level binary variables, returns n proportion TRUE continuous variables, returns mean standard deviation default. Specify alternative summary statistics using .cont_fx. default, summary_report() guess measurement level variable. can overridden variables using .default argument, select variables using nom(), bin(), cont() measurement wrappers. See details.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize variables based on measurement level — summary_report","text":"","code":"summary_report( .data, ..., .default = c(\"auto\", \"nom\", \"bin\", \"cont\"), .drop = TRUE, .cont_fx = list(mean, sd), .missing_label = NA, na.rm = FALSE, na.rm.nom = na.rm, na.rm.bin = na.rm, na.rm.cont = na.rm ) nom(...) bin(...) cont(...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize variables based on measurement level — summary_report","text":".data data frame data frame extension. ... one variable names. /tidyselect expressions. Elements may wrapped nom(), bin(), cont() force summarizing binary, nominal, continuous, respectively; see details. .default determine measurement level variables specified measurement wrapper. \"auto\" guess measurement level variable, \"nom\", \"bin\", \"cont\" treat unwrapped variables nominal, binary, continuous, respectively. .drop FALSE, frequencies nominal variables include counts empty groups (.e. levels factors exist data). .cont_fx list containing two functions continuous variables summarized. .missing_label label missing values nominal variables. na.rm TRUE, NA values variable dropped prior computation. na.rm.nom, na.rm.bin, na.rm.cont control NA handling specifically nominal, binary, continuous variables. Overrides na.rm variable type.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"determining-measurement-level","dir":"Reference","previous_headings":"","what":"Determining measurement level","title":"Summarize variables based on measurement level — summary_report","text":"measurement level variable determined follows: Variables wrapped nom(), bin(), cont() treated nominal, binary, continuous, respectively. Variables without measurement wrapper treated type specified .default. .default \"auto\", measurement level inferred: Logical vectors treated binary missing values na.rm.bin = TRUE. Character vectors, factors, logical vectors missing values treated nominal. variables treated continuous.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"support-for-binary-variables","dir":"Reference","previous_headings":"","what":"Support for binary variables","title":"Summarize variables based on measurement level — summary_report","text":"treated binary, must true: variable must either logical vector, binary numeric vector containing 0s 1s. variable must include missing values, na.rm.bin must set TRUE. Future extensions may allow handling dichotomous variables (e.g., \"Pregnant\" vs. \"pregnant\"), currently supported. Instead, consider converting logical indicator, e.g., Pregnant = PregnancyStatus == \"Pregnant\".","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_report.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize variables based on measurement level — summary_report","text":"","code":"if (FALSE) { # \\dontrun{ # create a report using pre-processed SOR data total_label <- \"SOR-II Overall\" data_baseline %>% group_with_total(ServiceType, .label = total_label) %>% summary_report( Age, Gender, Race, bin(DAUseAlcohol, DAUseIllegDrugs, DAUseBoth), DAUseAlcoholDays, DAUseIllegDrugsDays, DAUseBothDays, DAUseAlcoholDaysOrdinal, DAUseIllegDrugsDaysOrdinal, DAUseBothDaysOrdinal, na.rm = TRUE, .drop = FALSE ) %>% pivot_wider( names_from = ServiceType, names_vary = \"slowest\", values_from = V1:V2 ) %>% relocate(contains(total_label), .after = Value) %>% add_rows_at_value(Variable, Race, DAUseBoth, DAUseBothDays) %>% print_all() } # }"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom summary table — summary_table","title":"Custom summary table — summary_table","text":"Generates summary table, row variable passed .vars column function passed ....","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom summary table — summary_table","text":"","code":"summary_table( .data, ..., .vars = where(is.numeric), na.rm = FALSE, .rows_group_by = NULL, .cols_group_by = NULL, .cols_group_opts = list(), .var_col_name = \"Variable\" )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom summary table — summary_table","text":".data data frame data frame extension (e.g. tibble). ... Functions apply variable specified .vars, function names (e.g., mean) anonymous functions (e.g., \\(x) mean(x, na.rm = TRUE)). function passed ... yield one column output table (one column per group .cols_group_by specified). Output column names can optionally specified. E.g., m = mean, sd, sem = \\(x) sd(x) / sqrt(n()) yields output columns named m, sd, sem. .vars Columns .data summarize. column passed .vars yield one row output table (one row per group .rows_group_by specified). na.rm logical value passed functions ... take na.rm argument. .rows_group_by Grouping variable(s) output rows. .cols_group_by Grouping variable(s) output columns. .cols_group_opts list additional arguments passed tidyr::pivot_wider() .cols_group_by specified. .var_col_name name output column containing variable names passed .vars. column dropped .var_col_name NULL one variable passed .vars.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/summary_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom summary table — summary_table","text":"","code":"# example data mtcars2 <- mtcars %>% dplyr::mutate( Transmission = dplyr::recode(am, `0` = \"auto\", `1` = \"manual\") ) # simple summary table. note specification of column and row names # for \"n\", \"m\", and \"weight\". mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = c(mpg, hp, weight = wt) ) #> # A tibble: 3 × 4 #> Variable n m sd #> #> 1 mpg 32 20.1 6.03 #> 2 hp 32 147. 68.6 #> 3 weight 32 3.22 0.978 # with column and row groupings mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = c(mpg, hp, weight = wt), .cols_group_by = cyl, .rows_group_by = Transmission ) #> # A tibble: 6 × 11 #> Transmission Variable n_4 m_4 sd_4 n_6 m_6 sd_6 n_8 m_8 #> #> 1 auto mpg 3 22.9 1.45 4 19.1 1.63 12 15.0 #> 2 auto hp 3 84.7 19.7 4 115. 9.18 12 194. #> 3 auto weight 3 2.94 0.408 4 3.39 0.116 12 4.10 #> 4 manual mpg 8 28.1 4.48 3 20.6 0.751 2 15.4 #> 5 manual hp 8 81.9 22.7 3 132. 37.5 2 300. #> 6 manual weight 8 2.04 0.409 3 2.76 0.128 2 3.37 #> # ℹ 1 more variable: sd_8 # `.var_col_name = NULL` will drop the variable name column if only one # variable is included in `.vars` mtcars2 %>% summary_table( n = n_valid, m = mean, sd, .vars = mpg, .cols_group_by = cyl, .rows_group_by = Transmission, .var_col_name = NULL ) #> # A tibble: 2 × 10 #> Transmission n_4 m_4 sd_4 n_6 m_6 sd_6 n_8 m_8 sd_8 #> #> 1 auto 3 22.9 1.45 4 19.1 1.63 12 15.0 2.77 #> 2 manual 8 28.1 4.48 3 20.6 0.751 2 15.4 0.566 # `.cols_group_opts` are passed as arguments to `pivot_wider()`. # for instance to customize column names with a glue specification: mtcars2 %>% summary_table( M = mean, SD = sd, .vars = c(mpg, hp, weight = wt), .cols_group_by = c(Transmission, cyl), .cols_group_opts = list(names_glue = \"{cyl} cyl {Transmission}: {.value}\") ) #> # A tibble: 3 × 13 #> Variable `4 cyl auto: M` `4 cyl auto: SD` `6 cyl auto: M` `6 cyl auto: SD` #> #> 1 mpg 22.9 1.45 19.1 1.63 #> 2 hp 84.7 19.7 115. 9.18 #> 3 weight 2.94 0.408 3.39 0.116 #> # ℹ 8 more variables: `8 cyl auto: M` , `8 cyl auto: SD` , #> # `4 cyl manual: M` , `4 cyl manual: SD` , `6 cyl manual: M` , #> # `6 cyl manual: SD` , `8 cyl manual: M` , `8 cyl manual: SD` "},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":null,"dir":"Reference","previous_headings":"","what":"Conditionally suppress warnings or messages — suppress_if","title":"Conditionally suppress warnings or messages — suppress_if","text":"Evaluates expression selectively suppressing warnings messages based content.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conditionally suppress warnings or messages — suppress_if","text":"","code":"suppress_warnings_if( expr, msg_contains = \"\", fixed = TRUE, perl = !fixed, ignore.case = FALSE, negate = FALSE, classes = \"warning\" ) suppress_messages_if( expr, msg_contains = \"\", fixed = TRUE, perl = !fixed, ignore.case = FALSE, negate = FALSE, classes = \"message\" )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Conditionally suppress warnings or messages — suppress_if","text":"expr expression evaluate. msg_contains string match message. Defaults empty string (matches messages). fixed logical indicating whether msg_contains matched fixed string.. perl logical indicating whether Perl-compatible regular expressions used msg_contains. ignore.case logical indicating whether case msg_contains ignored. negate logical indicating whether message matching negated (e.g., suppress messages match msg_contains). classes character vector warning message classes suppress.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Conditionally suppress warnings or messages — suppress_if","text":"result evaluating expr, specified warnings messages suppressed.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/suppress_if.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Conditionally suppress warnings or messages — suppress_if","text":"","code":"# Suppress warnings containing specific text suppress_warnings_if(warning(\"This is a warning\"), \"This\") # Suppress messages unless they contain specific text suppress_messages_if( message(\"13 files processed\"), \"\\\\d{2, }\", fixed = FALSE, negate = TRUE )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":null,"dir":"Reference","previous_headings":"","what":"Swap column values, optionally based on condition — swap","title":"Swap column values, optionally based on condition — swap","text":"swap() swaps values two columns. swap_if() swaps values rows condition met. x y cast common type using vctrs::vec_cast_common().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Swap column values, optionally based on condition — swap","text":"","code":"swap(.data, x, y) swap_if(.data, cond, x, y, missing = c(\"NA\", \"keep\", \"swap\"))"},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Swap column values, optionally based on condition — swap","text":"x column swap y. y column swap x. cond logical vector. missing cond NA. \"NA\" replaces x y NA. \"keep\" keeps values original columns (though cond FALSE). \"swap\" swaps values x y (though cond TRUE).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/swap.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Swap column values, optionally based on condition — swap","text":"Based Hadley's code dplyr GitHub issue.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":null,"dir":"Reference","previous_headings":"","what":"Print symbols as a character vector — syms_to_chr","title":"Print symbols as a character vector — syms_to_chr","text":"helper converting list symbols character vector. Primarily intended help convert old code given updates summary_report().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print symbols as a character vector — syms_to_chr","text":"","code":"syms_to_chr(..., width = 80, indent = 0, indent_first = indent)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print symbols as a character vector — syms_to_chr","text":"... symbols. width maximum width line output. indent number spaces indent. indent_first number spaces indent first line.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/syms_to_chr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print symbols as a character vector — syms_to_chr","text":"","code":"syms_to_chr( various, very, video, view, village, visit, vote, wage, wait, walk, wall, want, war, warm, wash, waste, watch, water, way, we, wear, wednesday, wee, week, weigh, welcome, well, west, what, when, where, whether, which, white, who, whole, why, wide, wife, will, win, wind, window, wish, with, within, without, woman, wonder, wood, word, work, world, worry, worse, worth, would, write, wrong, year, yes, yesterday, yet, you, young ) #> c(\"various\", \"very\", \"video\", \"view\", \"village\", \"visit\", \"vote\", \"wage\", #> \"wait\", \"walk\", \"wall\", \"want\", \"war\", \"warm\", \"wash\", \"waste\", \"watch\", #> \"water\", \"way\", \"we\", \"wear\", \"wednesday\", \"wee\", \"week\", \"weigh\", \"welcome\", #> \"well\", \"west\", \"what\", \"when\", \"where\", \"whether\", \"which\", \"white\", \"who\", #> \"whole\", \"why\", \"wide\", \"wife\", \"will\", \"win\", \"wind\", \"window\", \"wish\", #> \"with\", \"within\", \"without\", \"woman\", \"wonder\", \"wood\", \"word\", \"work\", #> \"world\", \"worry\", \"worse\", \"worth\", \"would\", \"write\", \"wrong\", \"year\", \"yes\", #> \"yesterday\", \"yet\", \"you\", \"young\")"},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Transpose a tibble — t_tibble","title":"Transpose a tibble — t_tibble","text":"Given tibble data.frame x, returns transpose x. Similar base::t(), accepts returns tibbles, includes options row column name handling.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Transpose a tibble — t_tibble","text":"","code":"t_tibble(x, names_to = \"Variable\", names_from = NULL)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/t_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Transpose a tibble — t_tibble","text":"x dataframe tibble. names_to Name column transposed tibble containing column names x names_from Column x used column names transposed tibble. specified x rownames, used; otherwise columns named ...1, ...2, etc.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":null,"dir":"Reference","previous_headings":"","what":"US state and territory data — territory","title":"US state and territory data — territory","text":"state.terr.name state.terr.abb expand built-state.name state.abb vectors adding US territories District Columbia. includes: American Samoa District Columbia Guam Northern Mariana Islands Puerto Rico Virgin Islands state.terr.data includes names, abbreviations, FIPS codes US states territories.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US state and territory data — territory","text":"","code":"state.terr.name state.terr.abb state.terr.data"},{"path":"https://ccsarapas.github.io/lighthouse/reference/territory.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US state and territory data — territory","text":"object class character length 56. object class character length 56. object class tbl_df (inherits tbl, data.frame) 56 rows 4 columns.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/reference/try_numeric.html","id":null,"dir":"Reference","previous_headings":"","what":"Suppress NA warning when coercing to numeric — try_numeric","title":"Suppress NA warning when coercing to numeric — try_numeric","text":"Coerces x numeric. x coerced, returns NA suppresses coercion warning.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/try_numeric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Suppress NA warning when coercing to numeric — try_numeric","text":"","code":"try_numeric(x) try.numeric(x)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":null,"dir":"Reference","previous_headings":"","what":"Unpack and assign — unpack-assign","title":"Unpack and assign — unpack-assign","text":"Assigns vector values equal-length vector names.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Unpack and assign — unpack-assign","text":"","code":"lhs %<-% rhs lhs %->% rhs"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Unpack and assign — unpack-assign","text":"%<-% operator left--right variant (%->%) allow parallel assignment, similar (e.g.) Python: See zeallot package similar operator advanced functionality.","code":"# python var1, var2, var3 = [2, 4, 6] # R c(var1, var2, var3) %<-% c(2, 4, 6)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/unpack-assign.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Unpack and assign — unpack-assign","text":"","code":"c(cyl4, cyl6, cyl8) %<-% split(mtcars, mtcars$cyl) cyl4 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 #> Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 #> Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 #> Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 #> Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 #> Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 split(mtcars, mtcars$gear) %->% c(G3, G4, G5) G5 #> mpg cyl disp hp drat wt qsec vs am gear carb #> Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.7 0 1 5 2 #> Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.9 1 1 5 2 #> Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.5 0 1 5 4 #> Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.5 0 1 5 6 #> Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.6 0 1 5 8 c(model_hp, model_size, model_trans) %<-% purrr::map( c(\"hp\", \"disp + wt\", \"gear * am\"), ~ lm(paste(\"mpg ~\", .x), data = mtcars) ) summary(model_size) #> #> Call: #> lm(formula = paste(\"mpg ~\", .x), data = mtcars) #> #> Residuals: #> Min 1Q Median 3Q Max #> -3.4087 -2.3243 -0.7683 1.7721 6.3484 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 34.96055 2.16454 16.151 4.91e-16 *** #> disp -0.01773 0.00919 -1.929 0.06362 . #> wt -3.35082 1.16413 -2.878 0.00743 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 2.917 on 29 degrees of freedom #> Multiple R-squared: 0.7809,\tAdjusted R-squared: 0.7658 #> F-statistic: 51.69 on 2 and 29 DF, p-value: 2.744e-10 #> summary(model_trans) #> #> Call: #> lm(formula = paste(\"mpg ~\", .x), data = mtcars) #> #> Residuals: #> Min 1Q Median 3Q Max #> -6.3800 -3.3063 -0.7567 3.1575 9.0200 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 1.277 8.217 0.155 0.87764 #> gear 4.943 2.539 1.947 0.06163 . #> am 44.578 14.010 3.182 0.00356 ** #> gear:am -9.838 3.614 -2.722 0.01103 * #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 4.512 on 28 degrees of freedom #> Multiple R-squared: 0.4938,\tAdjusted R-squared: 0.4396 #> F-statistic: 9.105 on 3 and 28 DF, p-value: 0.0002282 #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a tidy selection to a vector of column names — untidyselect","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"Returns column names selected expression character vector (default) list symbols (syms = TRUE).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"","code":"untidyselect(data, selection, syms = FALSE)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/untidyselect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a tidy selection to a vector of column names — untidyselect","text":"","code":"dplyr::storms %>% untidyselect(c(name:hour, category, tidyselect::ends_with(\"diameter\"))) #> [1] \"name\" \"year\" #> [3] \"month\" \"day\" #> [5] \"hour\" \"category\" #> [7] \"tropicalstorm_force_diameter\" \"hurricane_force_diameter\" mtcars %>% untidyselect(mpg:drat, syms = TRUE) #> [[1]] #> mpg #> #> [[2]] #> cyl #> #> [[3]] #> disp #> #> [[4]] #> hp #> #> [[5]] #> drat #>"},{"path":"https://ccsarapas.github.io/lighthouse/reference/winsorize.html","id":null,"dir":"Reference","previous_headings":"","what":"Winsorize extreme values — winsorize","title":"Winsorize extreme values — winsorize","text":"Sets values max_dev deviations center max_dev deviations center. Deviations defined standard deviation (default) mean absolute deviation (method = \"mad\"). Center defined mean method = \"sd\" median method = \"mad\", unless otherwise specified center argument.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/winsorize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Winsorize extreme values — winsorize","text":"","code":"winsorize( x, max_dev = 3, method = c(\"sd\", \"mad\"), mad.center = c(\"median\", \"mean\") )"},{"path":"https://ccsarapas.github.io/lighthouse/reference/wkappa.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Cohen's kappa and weighted kappa — wkappa","title":"Compute Cohen's kappa and weighted kappa — wkappa","text":"tidyverse-friendly wrapper around psych::cohen.kappa().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/wkappa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Cohen's kappa and weighted kappa — wkappa","text":"","code":"wkappa(.data, x, y)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":null,"dir":"Reference","previous_headings":"","what":"Write a styled data frame to an Excel file — write_xlsx_styled","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"wrapper around openxlsx::write.xlsx() default styling options including frozen, bolded row headings auto column widths.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"","code":"write_xlsx_styled(x, file, asTable = FALSE, overwrite = TRUE, ...)"},{"path":"https://ccsarapas.github.io/lighthouse/reference/write_xlsx_styled.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write a styled data frame to an Excel file — write_xlsx_styled","text":"x data frame write. file path output Excel file. asTable Whether write Excel table. overwrite Whether overwrite existing file. ... Additional arguments passed openxlsx::write.xlsx().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/zap_everything.html","id":null,"dir":"Reference","previous_headings":"","what":"Strip special attributes from SPSS dataset — zap_everything","title":"Strip special attributes from SPSS dataset — zap_everything","text":"Removes special attributes data read SPSS, optionally converting labelled vectors factors .as_factor = TRUE (default).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/reference/zap_everything.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Strip special attributes from SPSS dataset — zap_everything","text":"","code":"zap_everything(.data, ..., .as_factor = TRUE)"},{"path":[]},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"summary-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Summary functions","title":"lighthouse 0.7.0","text":"summary_report() returns summary multiple variables, summarizing variable based level measurement. df_compare() utility identifying differences data frames. Given two data frames, returns rows columns differences.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-missing-values-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for missing values","title":"lighthouse 0.7.0","text":"na_if_range() renamed, expanded, bug-fixed version coerce_na_range(). coerce_na_range() retained alias back compatibility. drop_na_rows() drops rows columns specific subset columns NA. first_valid(), last_valid(), nth_valid() return nth non-missing value vector.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-character-vectors-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for character vectors","title":"lighthouse 0.7.0","text":"str_c_narm() variant stringr::str_c() alternative handling NAs. str_c_tidy() variant stringr::str_c() accepts tidyselect expressions. str_ends_any() added complement str_starts_any() str_detect_any().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-dates-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for dates","title":"lighthouse 0.7.0","text":"ffy() sfy_il() return federal fiscal year Illinois state fiscal year given date. wrap fiscal_year(), returns fiscal year based specified starting month. strftime_no_lead() formats date without leading zeroes (e.g., “6/7/2024” instead “06/07/2024”). nth_bizday() generalization next_bizday().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"tools-for-service-cascades-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Tools for service cascades","title":"lighthouse 0.7.0","text":"cascade_fill_bwd() cascade_fill_fwd() impute values service cascade data based previous subsequent cascade steps. cascade_summarize() returns summary table service cascade data. functions yet fully documented.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"statistical-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Statistical functions","title":"lighthouse 0.7.0","text":"se_mean() se_prop() compute standard error mean proportion, respectively. se_prop() includes checks unreliability due low variance; see “Details.” se_mean() replaces ambiguously-named se(), now deprecated. ci_sig() tests confidence interval indicates statistical significance. OR_to_p1() OR_to_p2() convert odds ratios probabilities. complement p_to_OR(). dunn_test() performs Dunn’s test, pairwise post-hoc test following Kruskal-Wallis test.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"math-functions-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Math functions","title":"lighthouse 0.7.0","text":"row_sums_across() variant base::rowSums() accepts tidyselect expressions alternative NA handling. sum_if_any(), min_if_any(), max_if_any() variants sum(), min(), max() remove NAs unless values NA. min_if_any() max_if_any() renamed safe_min() safe_max().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"variable-transformation-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Variable transformation","title":"lighthouse 0.7.0","text":"fct_collapse_alt() variant forcats::fct_collapse() options handle non-existent values level ordering. fct_na_if() variant dplyr::na_if() also removes specified value factor’s levels. swap() swaps values two columns. unconditional variant swap_if().","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"data-restructuring-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Data restructuring","title":"lighthouse 0.7.0","text":"add_rows_at_value() similar add_blank_rows(), allows specifying position column values rather row numbers. Note changes function interface pre-release version; see “Details” section documentation. pad_vectors() pads list vectors NAs common length.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"exporting-results-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Exporting results","title":"lighthouse 0.7.0","text":"add_plot_slide() helper exporting plots PowerPoint easier control size positioning. write_xlsx_styled() writes .xlsx basic column formatting.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"data-visualization-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Data visualization","title":"lighthouse 0.7.0","text":"add_crossings() helper creating area charts different fills positive vs negative values. after_opacity() before_opacity() utilities color blending.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-0-7-0","dir":"Changelog","previous_headings":"New functions","what":"Other","title":"lighthouse 0.7.0","text":"open_file() (alias file.open()) opens file default application. open_folder() (alias dir.open()) opens folder system file manager. Given two vectors, set_compare() returns labelled subsets unique shared elements. suppress_warnings_if() suppress_messages_if() conditionally suppress warnings messages based text. eq_shape() checks two objects number dimensions length along dimension.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"new-datasets-0-7-0","dir":"Changelog","previous_headings":"","what":"New datasets","title":"lighthouse 0.7.0","text":"gain_missing_codes quick reference missing value labels used GAIN datasets. state.terr.name state.terr.abb versions state.name state.abb include US territories District Columbia. state.terr.data data frame including names, abbreviations, FIPS codes US states, territories, District Columbia.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"added-functionality-0-7-0","dir":"Changelog","previous_headings":"","what":"Added functionality","title":"lighthouse 0.7.0","text":"count_pct() count_multiple() now support .argument per-operation grouping. Integration .count_*() functions planned future update. summary_table(), column variable names can dropped one variable included setting .var_col_name = NULL (#9). count_duplicates() now returns unique total number duplicated values. (e.g., c(2, 2, 4, 4) two unique four total values.) Added missing argument swap_if() options cases condition missing. Added warn_factor argument try_numeric()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"bug-fixes-0-7-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"lighthouse 0.7.0","text":".cols_group_by argument summary_table() now produces separate columns group (fixes #6). count_with_total() now produces totals non-character columns (fixes #10). days_diff() now handles inputs different types (e.g., date datetime) warning (previously threw error). Added General Election Day holidays_il arranged date (fixes #1). Removed Inauguration Day holidays_us.","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-changes-0-7-0","dir":"Changelog","previous_headings":"","what":"Other changes","title":"lighthouse 0.7.0","text":"asterisks(), changed default include_key TRUE FALSE. percent() comma() re-exported scales (#11).","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lifecycle-changes-0-7-0","dir":"Changelog","previous_headings":"","what":"Lifecycle changes","title":"lighthouse 0.7.0","text":"rbool() un-deprecated. previously deprecated favor purrr::rbernoulli(), purrr::rbernoulli() since deprecated . pivot_wider_alt() defunct. Changes tidyr::pivot_wider() made important functionality unnecessary. changes tidyr broke , judged worth effort fixing. na_like() median_dbl() deprecated. longer needed given flexible handling mixed classes dplyr::if_else() dplyr::case_when() [dplyr v1.1.0][https://dplyr.tidyverse.org/news/index.html#vctrs-1-1-0]. (Plus na_like() quite buggy unreliable; resolves #2). row_sums_spss() deprecated favor row_sums_across(). safe_min() safe_max() renamed min_if_any() max_if_any(); old names deprecated. se() renamed se_mean(); old name deprecated.","code":""},{"path":[]},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"new-functions-0-6-0","dir":"Changelog","previous_headings":"","what":"New functions","title":"lighthouse 0.6.0","text":"group_with_total() count_multiple() count_unique() count_duplicates() cols_info() wkappa() cohen_w() median_dbl() safe_min(), safe_max() pmin_across(), pmax_across() cumsum_desc() scale_vec() reverse_key() add_header() t_tibble() rev_rows() fct_reorder_n() find_na_cols(), drop_na_cols() n_valid(), pct_valid(), n_pct_valid() discard_na() null_to_na() is_valid() str_prefix(), str_suffix() glue_chr() datetimes_to_date() next_bizday() is_duplicate() is_spss() is_coercible_integer(), is_coercible_logical() gain_ss_score()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"other-changes-0-6-0","dir":"Changelog","previous_headings":"","what":"Other changes","title":"lighthouse 0.6.0","text":"Added datasets federal (holidays_us), Illinois (holidays_il), Chestnut Health Systems (holidays_chestnut) holidays (primarily use withnext_bizday()` function). Added strict argument is_TRUE(), is_FALSE(), is_TRUE_or_NA(), is_FALSE_or_NA() Improvements set_ggplot_opts(), ggview(), is_coercible_numeric() Bugfixes in_excel(), count_na(), summary_table(), pivot_wider_alt(), print_all(), asterisks(), coerce_na_range() Remove check lighthouse updates load","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-050","dir":"Changelog","previous_headings":"","what":"lighthouse 0.5.0","title":"lighthouse 0.5.0","text":"Check lighthouse update available load New infix operators: %all_in%, %any_in% Exported na_like()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-041","dir":"Changelog","previous_headings":"","what":"lighthouse 0.4.1","title":"lighthouse 0.4.1","text":"Bugfix print_all()","code":""},{"path":"https://ccsarapas.github.io/lighthouse/news/index.html","id":"lighthouse-040","dir":"Changelog","previous_headings":"","what":"lighthouse 0.4.0","title":"lighthouse 0.4.0","text":"New logical tests: is_TRUE(), is_FALSE(), is_TRUE_or_NA(), is_FALSE_or_NA(), is_coercible_numeric() New count functions: crosstab(), count_na() New data transformations: scale_mad(), winsorize() New date functions: floor_month(), floor_week(), floor_days(), days_diff() new functions: asterisks(), print_n(), print_all(), na_to_null(), set_ggplot_opts() Added added optional name argument in_excel()","code":""}]