add_trend: Adds a trend variable to a data set

Description Usage Arguments Examples

Description

This function adds a column to a dataset, running from 1 to the length of the data set. If the data set is segmented using the group_by function, a column is added for every subset.

Usage

1
add_trend(av_state, subset_id = 1, varname = "index", log_level = 0)

Arguments

av_state

an object of class av_state

subset_id

either an integer subset index or the the value for the id_field column that was used in the group_by function. The subset_id argument is required if the data set is grouped into multiple data sets (i.e., if the group_by function was used), in which case the function works on the specified data subset.

varname

the name of the newly created indexing column. Will be postfixed with underscores if the column already exists

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 the columns being added.

Examples

1
2
3
4
5
6
7
## Not run: 
av_state <- load_file("../data/input/pp1 nieuw compleet.sav")
av_state <- add_trend(av_state)
column_names_output(av_state)
av_state$data[[1]][c('index','index2')]

## End(Not run)

roqua/autovar documentation built on May 27, 2019, 10:41 p.m.