Count number of occurences in repeated variables (r) -
i need summarise number of days people have worked during week. each variables represent day.
i need produce summary of number of days worked.
i not quite sure convenient manner (beside summing table each day).
any suggestions ?
data = structure(list(actwkdy1 = structure(c(2l, na, 6l, 9l, 2l, 2l, 2l, na, 2l, 3l), .label = c("friday", "monday", "not working @ all", "saturday", "scheduled working days not relevant", "sunday", "thursday", "tuesday", "wednesday"), class = "factor"), actwkdy2 = structure(c(6l, na, 2l, 5l, 6l, 6l, 6l, na, 6l, na), .label = c("friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"), class = "factor"), actwkdy3 = structure(c(7l, na, 6l, 1l, 7l, 5l, 7l, na, 7l, na), .label = c("friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"), class = "factor"), actwkdy4 = structure(c(5l, na, 7l, 3l, 5l, 1l, 5l, na, 5l, na), .label = c("friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday" ), class = "factor"), actwkdy5 = structure(c(1l, na, 5l, 4l, 1l, 3l, 1l, na, 1l, na), .label = c("friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"), class = "factor"), actwkdy6 = structure(c(na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_), .label = c("friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"), class = "factor"), actwkdy7 = structure(c(na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_, na_integer_), .label = c("friday", "monday", "saturday", "sunday", "thursday", "wednesday"), class = "factor")), row.names = c(na, 10l), class = "data.frame", .names = c("actwkdy1", "actwkdy2", "actwkdy3", "actwkdy4", "actwkdy5", "actwkdy6", "actwkdy7")) actwkdy1 actwkdy2 actwkdy3 actwkdy4 actwkdy5 actwkdy6 actwkdy7 monday tuesday wednesday thursday friday <na> <na> <na> <na> <na> <na> <na> <na> <na> sunday monday tuesday wednesday thursday <na> <na> wednesday thursday friday saturday sunday <na> <na> monday tuesday wednesday thursday friday <na> <na> monday tuesday thursday friday saturday <na> <na> monday tuesday wednesday thursday friday <na> <na> <na> <na> <na> <na> <na> <na> <na> monday tuesday wednesday thursday friday <na> <na> not working @ <na> <na> <na> <na> <na> <na>
would make sense?
table(unlist(data)) view(table(unlist(data))) var1 freq friday 6 monday 6 not working @ 1 saturday 2 scheduled working days not relevant 0 sunday 2 thursday 7 tuesday 6 wednesday 6
Comments
Post a Comment