I would suggest next approach, which is also close to the one proposed by @Humpelstielzchen, that is close to what you show in the image:
library(dplyr)
df %>% bind_rows(df %>% group_by(date,location) %>%
mutate(value=as.numeric(value)) %>%
summarise(value=sum(value,na.rm=F)) %>%
mutate(type='total type',value=as.character(value)))
Output:
date type location value
1 17/08/2020 type A USA 10
2 17/08/2020 type B USA 10
3 17/08/2020 type A India frak
4 17/08/2020 type B India frak
5 18/08/2020 type A USA 15
6 18/08/2020 type B USA 15
7 18/08/2020 type A India open
8 18/08/2020 type B India open
9 17/08/2020 total type India <NA>
10 17/08/2020 total type USA 20
11 18/08/2020 total type India <NA>
12 18/08/2020 total type USA 30
Update: Here an approach that could works because of OP'issues with version of package:
library(dplyr)
#Data
date <- c("17/08/2020", "17/08/2020", "17/08/2020", "17/08/2020","18/08/2020", "18/08/2020", "18/08/2020", "18/08/2020")
type <- c("type A", "type B", "type A", "type B","type A", "type B","type A", "type B")
location <- c("USA","USA","India","India","USA","USA","India","India")
value <- c("10","10","frak","frak","15","15","open","open")
df <- data.frame(date, type, location, value,stringsAsFactors = F)
#Mutate for summary
df1 <- df %>% group_by(date,location) %>%
mutate(value=as.numeric(value)) %>%
summarise(value=sum(value,na.rm=F)) %>%
mutate(type='total type') %>% ungroup()
df1$value <- as.character(df1$value)
#Bind
df2 <- rbind(df,df1)
Output:
date type location value
1 17/08/2020 type A USA 10
2 17/08/2020 type B USA 10
3 17/08/2020 type A India frak
4 17/08/2020 type B India frak
5 18/08/2020 type A USA 15
6 18/08/2020 type B USA 15
7 18/08/2020 type A India open
8 18/08/2020 type B India open
9 17/08/2020 total type India <NA>
10 17/08/2020 total type USA 20
11 18/08/2020 total type India <NA>
12 18/08/2020 total type USA 30