The dataset is as follows:
The output should be as follows
I have tried the following things
- sum <- gather(Learning_platform, A,B)I used the- gatherfunction from- tidyr, but it did not give me the desired result. It just gathered the data and separated it by underscores.
2.df %>% group_by(A) %>% summarise(B = sum(B))
This also did not work as the sum of factors could not be processed by R.
- I also used the following example from the tidyrpackage to no avail:
df %>% group_by(A,B) %>% 
       summarise(A,B)) %>% 
       spread(ID, A,B,C,D) %>% 
       ungroup() %>%
Kindly suggest a solution or learning material for the above example.


 
     
    