Description Usage Arguments Value Examples
View source: R/counting_events_group.R
creates a data.frame counting occurencies of specific events in a given vector separated by named connex groups. For example it allows to count occurencies of each category of a qualitative variable above in the dataset for each individual. Grouping allows to reset the count each time another variable changes.
The idea is to create a cumulative history of what happened before current individual.
One new variable is created for each unique value of events
1 2 3 4 5 6 7 8 9 |
events |
The vector of events to count (qualitative values). One new variable is created for each unique value of events. |
group |
qualitative vector that resets counting when its value changes. |
base |
a dataframe to which counting can be added (cbind). |
prefix |
(optional) prefix to the newly created variables names |
suffix |
(optional) suffix to the newly created variables names |
clean |
(boolean) to decide either or not variables names has to be cleaned (spaces, accents and special characters) |
keep |
(boolean) to decide either or not events and group are to be added to the resulting data.frame |
a data.frame which number of rows is the length of events
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.