Hi
I have a dataset with teacher names and their support for a particular program. Their support is gauged wee-wise as shown in the sample data given below. I want to get the frequency of different support scales. Let us say the first teacher Nithin. I want know how many times he gave support for each scale. That will look like the data frame "data2"as shown below. How can I do this?
library(tidyverse)
library(janitor)
data<-tibble::tribble(
~teacher_name, ~tch_support, ~week,
"Nithin", 0.25, 1L,
"Supriya", 0.5, 1L,
"Sunitha", 0.75, 1L,
"Pradeep", 0.5, 1L,
"Madhumati", 0.5, 1L,
"Prathibha", 0.5, 1L,
"Nithin", 0.5, 2L,
"Supriya", 0.25, 2L,
"Sunitha", 0.25, 2L,
"Pradeep", 0.25, 2L,
"Madhumati", 0.75, 2L,
"Prathibha", 0.75, 2L,
"Nithin", 0.75, 3L,
"Supriya", 0.5, 3L,
"Sunitha", 0.5, 3L,
"Pradeep", 0.5, 3L,
"Madhumati", 0, 3L,
"Prathibha", 0, 3L,
"Nithin", 0, 4L,
"Supriya", 0, 4L,
"Sunitha", 0.25, 4L,
"Pradeep", 0.25, 4L,
"Madhumati", 0.25, 4L,
"Prathibha", 0.25, 4L,
"Nithin", 0.5, 5L,
"Supriya", 0.5, 5L,
"Sunitha", 0.5, 5L,
"Pradeep", 0.75, 5L,
"Madhumati", 0.75, 5L,
"Prathibha", 0.75, 5L
)
data2<-tibble::tribble(
~teacher_name, ~`0`, ~`0.25`, ~`0.5`, ~`0.75`,
"Nithin", 0L, 3L, 5L, 6L,
"Supriya", 0L, 4L, 6L, 4L,
"Sunitha", 0L, 1L, 1L, 1L,
"Pradeep", 0L, 4L, 5L, 2L,
"Madhumati", 0L, 5L, 6L, 4L,
"Prathibha", 0L, 3L, 2L, 4L
)