group_by: Split up a data set into different subsets

View source: R/group_by.r

group_byR Documentation

Split up a data set into different subsets

Description

This function splits up the initial data set into multiple sets based on their value for id_field. For example, if we have a data set with a field named id that has values ranging from 11 to 15, calling av_state <- group_by('id') will set av_state$data to a list of five items. This list is ordered by the value of the id field. Then, we can use av_state$data[[1]] (or equivalently, av_state$data[['11']]) to retrieve the rows in the data set that have id 11. Likewise, use av_state$data[[2]] or av_state$data[['12']] for rows with id 12. This function can only be called once per av_state.

Usage

group_by(av_state, id_field)

Arguments

av_state

an object of class av_state

id_field

the name of a column in the data set

Value

This function returns the modified av_state object.

Examples

## Not run: 
av_state <- load_file("../data/input/RuwedataAngela.sav",log_level=3)
print(av_state)
av_state <- group_by(av_state,'id')
print(av_state)

## End(Not run)

roqua/autovar documentation built on Jan. 21, 2023, 7:37 p.m.