View source: R/add_derived_column.r
add_derived_column | R Documentation |
This function adds a new column, based on existing columns, to all identified groups in the given data set.
add_derived_column( av_state, name, columns, operation = c("SUM", "AVG", "LN", "MINUTES_TO_HOURS", "SQUARED"), log_level = 0 )
av_state |
an object of class |
name |
the name of the new column |
columns |
the existing columns that the new column will be based on |
operation |
this argument has three possible values:
|
log_level |
sets the minimum level of output that should be shown (a number between 0 and 3). A lower level means more verbosity. Specify a log_level of 3 to hide messages about converting columns or increasing values for the 'LN' option. |
This function returns the modified av_state
object.
## Not run: av_state <- load_file("../data/input/RuwedataAngela.sav") av_state <- add_derived_column(av_state,'SomPHQ',c('PHQ1','PHQ2','PHQ3','PHQ4', 'PHQ5','PHQ6','PHQ7','PHQ8','PHQ9'), operation='SUM') column_names_output(av_state) av_state <- load_file("../data/input/pp1 nieuw compleet.sav",log_level=3) av_state <- add_derived_column(av_state,'SomBewegUur','SomBewegen', operation='MINUTES_TO_HOURS') av_state <- add_derived_column(av_state,'lnSomBewegUur','SomBewegUur', operation='LN') av_state$data[[1]][c('SomBewegen','SomBewegUur','lnSomBewegUur')] ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.