Learn R Programming

tidysynthesis (version 0.1.2)

add_sequence_numeric: Add to visit sequence for numeric variables

Description

Add to visit sequence for numeric variables

Usage

add_sequence_numeric(
  roadmap,
  ...,
  method = c("correlation", "proportion", "weighted total", "absolute weighted total",
    "weighted absolute total"),
  cor_var = NULL,
  na.rm = FALSE,
  cor_use = "everything"
)

Value

An updated visit_sequence

Arguments

roadmap

A roadmap object

...

<tidy-select> One or more unquoted expressions separated by commas. Variable names can be used as if they were positions in the data frame, so expressions like x:y can be used to select a range of variables.

method

A quoted name for the method used to sort the visit_sequence

cor_var

A numeric variable for the correlation method

na.rm

Boolean that if TRUE, removes NA values from computations

cor_use

A string correlation data method passed to stats::cor if using. If na.rm == TRUE then defaults to complete.obs. See ?stats::cor for more options.

Examples

Run this code

roadmap(
  conf_data = acs_conf_nw, 
  start_data = acs_start_nw
) |>
  add_sequence_numeric(
    dplyr::where(is.numeric), 
    method = "correlation", 
    cor_var = "age",
    na.rm = TRUE
  )

Run the code above in your browser using DataLab