Within a data frame (see below), I would like to compute the frequency of each activity/event (see second column). The frequency of the events should be shown in the appropriate columns (third until sixth).
user activity Open Docu Read Docu Edit Docu Close Docu
1 c("Open Docu", "Close Docu",…)
2 c("Open Docu", "Read Docu",…)
3 c("Open Docu", "Close Docu",…)
4 c("Open Docu", "Edit Docu",…)
E.g. in column 3 (Open Document) and row 2 (user 1) should be written the number "1" and in column 6 (Close Document) should also be computed "1".
Or if user 4 edits a document five times, then "5" should be shown in column 5 (Edit Document) and row 5 (user 4).
How can I apply a loop-function (due to a massive amount of users) to count the frequency in each cell?