Was it helpful?

Question

How to create a frequency table of a vector that contains repeated values in R?

R ProgrammingServer Side ProgrammingProgramming

We can do this by using table function with as.data.frame

Example

> X <- c(25, 34, 25, 47, 69, 69, 69, 23, 24, 25, 23, 21, 70, 34, 25, 47, 21, 23, 69, 69, 25, 64)
> as.data.frame(table(X))
  X Freq
1 21 2
2 23 3
3 24 1
4 25 5
5 34 2
6 47 2
7 64 1
8 69 5
9 70 1
raja
Published on 06-Jul-2020 16:27:10
Advertisements
Was it helpful?
Not affiliated with Tutorialspoint
scroll top