Well, the provided dataset is inconsistent: it contains 7 column names, but has 8 column values..
Anyway, there are several ways to achieve the desired outcome and the following is along the lines of the referenced post:
library(dplyr)
## create a dataframe
df <- tribble(
~a, ~b, ~c, ~d, ~e, ~f, ~g,
1, 27, 56, 87, 32, 0, 5,
2, 0, 0, 20, 21, 12, 5,
)
df
#> # A tibble: 2 x 7
#> a b c d e f g
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 27 56 87 32 0 5
#> 2 2 0 0 20 21 12 5
## add a new row containing the sum of each column
df[nrow(df) + 1, ] <- as.list(colSums(df))
df
#> # A tibble: 3 x 7
#> a b c d e f g
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 27 56 87 32 0 5
#> 2 2 0 0 20 21 12 5
#> 3 3 27 56 107 53 12 10
Created on 2021-03-19 by the reprex package (v1.0.0)
HTH