0

In R, how do you merge(and get a count of) identical string values in a single column (so there's only one of each) and put the correlating count of those string values into a new column? I'm still relatively new, so any assistance would be appreciated. Thanks!

EX:

input_data = data.frame(fruit = c(apple, apple, orange, orange, orange, banana))

desire_output = data.frame(fruit = c(apple, orange, banana),
                           count = c(2, 3, 1))
Simon.S.A.
  • 5,232
  • 6
  • 23
  • 37

0 Answers0