Learn R Programming

tidysynthesis (version 0.1.2)

visit_sequence: Generate a visit sequence.

Description

Generate a visit sequence.

Usage

visit_sequence(schema, weight_var = NULL, synthesize_weight = TRUE)

Value

A visit_sequence object.

Arguments

schema

A schema object.

weight_var

A numeric weight for the weighted total ordering.

synthesize_weight

Boolean for if weight_var should be included in the visit sequence.

Examples

Run this code

df <- data.frame(
  factor_var = c("1", "1", "2"),
  vara = c(10000, 20000, 100000),
  varb = c(300, 200, 100),
  var_loss = c(1999999, 0, -1000000),
  weight = c(1000, 1000, 2000)
)

start_df <- dplyr::select(df, factor_var)

schema1 <- schema(
  conf_data = dplyr::select(df, -weight),
  start_data = start_df
)
                  
vs1 <- visit_sequence(
  schema = schema1
)

schema2 <- schema(
  conf_data = df,
  start_data = start_df
)

vs2 <- visit_sequence(
  schema = schema2,
  weight_var = weight,
  synthesize_weight = TRUE
)

Run the code above in your browser using DataLab