I know there is an easy way to do this...but, I can\'t figure it out.
I have a dataframe in my R script that looks something like this:
A B C 1.2
In dplyr:
dplyr
library(tidyverse) A <- c(1.2, 2.3, 2.3, 1.2, 3.4, 1.2) B <- c(4, 4, 6, 3, 2, 5) C <- c(8, 9, 0, 3, 1, 1) df <- data_frame(A, B, C) df %>% group_by(A) %>% summarise(num = n(), totalB = sum(B))