1
You can do something like this:
df <- data.frame(x = c(1,1,2,2,2,3,3,3,4,4, NA))
df
x
1 1
2 1
3 2
4 2
5 2
6 3
7 3
8 3
9 4
10 4
11 NA
library(dplyr)
df %>%
group_by(x) %>%
summarise(sum(x))
# A tibble: 5 x 2
x `sum(x)`
<dbl> <dbl>
1 1 2
2 2 6
3 3 9
4 4 8
5 NA NA
Hello, Bruno. Do you want to consider adding the rows, the columns or the whole date.frame? In the title you ask for an action and in the description you ask for another. What do you need to do? Edit your question so we can help.
– neves
Try
tbl <- table(x);tbl <- data.frame(value = names(tbl), count = unclass(tbl))
.– Rui Barradas