add_columns: Add derived variables to a dataframe

Description Usage Arguments Value Examples

View source: R/datacollation.R

Description

Add derived variables to a dataframe

Usage

1
add_columns(df, num_parameters)

Arguments

df

dataframe with columns including "Generation" and "NumCells"

num_parameters

number of parameters, accounting for the first set of columns in the dataframe

Value

The same dataframe with additional columns. For each simulation, "JustBeforeTTT" and "JustAfterTTT" are binary indicators for treated tumours; "maxgen" is the maximum value of Generation; "gen_adj" is the time elapsed since Generation zero, relative to maxgen; SmoothNumCells is NumCells with loess smoothing; SmoothRadius is the radius of a disc of area NumCells, after loess smoothing; GrowthRate and RadiusGrowthRate are the rates of change of SmoothNumCells and SmoothRadius, relative to Generation. Deal differently with dataframe containing the column "Treated".

Examples

1
2
3
df <- data.frame(p = 1, seed = rep(1:2, each = 10), 
Generation = c(1:10, 3:12), NumCells = rep(1:10, times = 2) + rnorm(20, 0, 0.1))
add_columns(df, 2)

robjohnnoble/demonanalysis documentation built on June 30, 2020, 12:47 a.m.