I have a data.frame
with many rows. I am trying to produce a new data.frame
summarizing the total row count for all combinations of V_ID
and N_ID
.
In the below, df1
is an example of my data and df2
is an example of the desired output.
df1 <- data.frame (V_ID = c(1234, 5252, 1234, 1234, 1234, 5252, 5252, 6754),
N_ID = c(45, 23, 45, 45, 45, 22, 23, 11),
Length = c(88, 33, 88, 88, 88, 33, 33, 22)
)
df2 <- data.frame (V_ID = c(1234, 5252, 5252, 6754),
N_ID = c(45, 23, 22, 11),
Num_Times=c(4, 2, 1, 1),
Length = c(88, 33, 33, 22)
)
Is there a way to do this in dplyr?