I used this is the code to add the percenatage row at the end:
adde_percent <- lapply(added_total, function(x){
last_row <- nrow(x)
pct <- Total / sum(Total)
x[last_row+1,] <- c("percentage", pct)
x
})
I have a list of data frames and want to add the percentage at the end of each data frame in a list. I already added the total. This is a screenshot of a data frame: