user.bayes - 19 days ago 5

R Question

This seems like a very simple problem, but I can't seem to sort it out. I have sought help from this forum, with the below topics being close, but don't seem to do exactly what I need. I have count data over several years. I want to obtain frequencies of the count value by year. It seems I need a table function with a grouping option, but I haven't found the proper syntax.

`Data:`

count year

1 15 1957

2 6 1957

3 23 1957

4 23 1957

5 2 1957

6 28 1980

7 15 1980

8 32 1980

9 18 1981

thank you in advance!

Counting the Number of Elements With The Values of x in a Vector?

grouping data splitted by frequencies

Aggregate data in R

Answer

You're looking for the `table`

function. Something like:

```
with(yourdata, table(Year, Count))
```