clean_TURN_output: clean TURN dataframe

Description Usage Arguments Value Examples

View source: R/TURN.R

Description

Output a simpler (fewer columns) dataframe, given an input dataframe made by either calc_TURN() or calc_path_TURN() functions. New TURN column is returned, which is the the Y_prime_3wma input column, where InstrumentVersion == 'all_adj'.

Usage

1
clean_TURN_output(df, extra_cols = NULL, is_path = FALSE)

Arguments

df

dataframe with at least columns of "InstrumentVersion", "epi_n_days", "Y", "path_Y", "epidate", and any other columns included in group_vars.

extra_cols

character vector of additional columns to keep in output

is_path

logical, whether dataframe is of pathogen level data (i.e. created in calc_path_TURN()).

Value

dataframe that includes TURN column (final normalization). It also includes path_TURN (the TURN for individual pathogens, when the is_path argument is TRUE)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
############## Generating data ################
national_list <- calc_TURN(TUR_dat, return_means = TRUE)
means <- national_list$means
# national TURN
TURN_national <- national_list$df

# calculate TURN for each pathogen -- national
path_turn_national <- calc_path_TURN(df = path_dat,
               TURN_df = TURN_national,
               means = means)

##### creating cleaner/simple dataframe #######

clean_TURN_output(TURN_national)
clean_TURN_output(path_turn_national, is_path = TRUE)

MartinHoldrege/turnr documentation built on May 16, 2020, 10:39 a.m.