Here is an example of my data:
Type <- c('A','A','A','A','B','B','C','D')
Name <- c('DK', 'MO', 'OM', 'LSO', 'GOP', 'ADG','BFC','TMD')
Value <- c(3,2,5,3,6,5,7,6)
Dat <- data.frame(Type, Name,Value)
Dat
Type Name Value
1 A DK 3
2 A MO 2
3 A OM 5
4 A LSO 3
5 B GOP 6
6 B ADG 5
7 C BFC 7
8 D TMD 6
What I'm trying to get is the sum of the value when Type=A. In this case, it is 13
. I found some similar examples by applying dplyr
, but I don't need the type nor the name. Please help and thank you!