group_by.Rd
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
.
group_by(av_state, id_field)
av_state | an object of class |
---|---|
id_field | the name of a column in the data set |
This function returns the modified av_state
object.
# 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) # }