reshape_long {msSPChelpR}R Documentation

Reshape dataset to long format - stats::reshape version

Description

Reshape dataset to long format - stats::reshape version

Usage

reshape_long(wide_df, case_id_var, time_id_var, datsize = Inf, chunks = 1)

Arguments

wide_df

dataframe in wide format

case_id_var

String with name of ID variable indicating same patient. E.g. idvar="PUBCSNUM" for SEER data.

time_id_var

String with name of variable that indicates diagnosis per patient. E.g. timevar="SEQ_NUM" for SEER data.

datsize

Number of rows to be taken from df. This parameter is mainly for testing. Default is Inf so that df is fully processed.

chunks

Numeric; default 1. Technical parameter how the data is split during reshaping.

Value

long df

Examples


data(us_second_cancer)

#prep step - reshape wide a sample of 10000 rows from us_second_cancer
usdata_wide_sample <- msSPChelpR::reshape_wide(us_second_cancer,
                         case_id_var = "fake_id", 
                         time_id_var = "SEQ_NUM", 
                         timevar_max = 2,
                         datsize = 10000)

#now we can reshape long again
msSPChelpR::reshape_long(usdata_wide_sample,
                         case_id_var = "fake_id", 
                         time_id_var = "SEQ_NUM")



[Package msSPChelpR version 0.9.1 Index]