Unique rows and sums in R

I want to create a new one in the data frame that only shows unique rows and how many times they are repeated in the initial data frame. This is from Rstudio.

How do I do this?

enter image description here


Assuming your data frame is called df, you can do:

as.data.frame(table(df))

#>       variable                      value Freq
#> 1 It is faster Neither agree nor disagree    1
#> 2 It is faster           not agree at all    3
#> 3 It is faster             Somewhat agree    1
#> 4 It is faster              Totally agree   10

Data transcribed from image in question

df <- structure(list(variable = c("It is faster", "It is faster", "It is faster", 
"It is faster", "It is faster", "It is faster", "It is faster", 
"It is faster", "It is faster", "It is faster", "It is faster", 
"It is faster", "It is faster", "It is faster", "It is faster"
), value = c("not agree at all", "Totally agree", "not agree at all", 
"Totally agree", "Neither agree nor disagree", "Totally agree", 
"Totally agree", "Somewhat agree", "Totally agree", "Totally agree", 
"not agree at all", "Totally agree", "Totally agree", "Totally agree", 
"Totally agree")), class = "data.frame", row.names = c(NA, -15L
))

df
#>        variable                      value
#> 1  It is faster           not agree at all
#> 2  It is faster              Totally agree
#> 3  It is faster           not agree at all
#> 4  It is faster              Totally agree
#> 5  It is faster Neither agree nor disagree
#> 6  It is faster              Totally agree
#> 7  It is faster              Totally agree
#> 8  It is faster             Somewhat agree
#> 9  It is faster              Totally agree
#> 10 It is faster              Totally agree
#> 11 It is faster           not agree at all
#> 12 It is faster              Totally agree
#> 13 It is faster              Totally agree
#> 14 It is faster              Totally agree
#> 15 It is faster              Totally agree