If I understand correctly you want the number of days per site. If your data looks like this:
site = c("a", "b", "c", "a", "b", "c", "a", "b", "c")
year = c(1991, 1992, 1993, 1991, 1992, 1993, 1991, 1992, 1993)
month = c(1, 1, 4, 4, 1, 1, 4, 4, 1)
my_data = data.frame(site, year, month)
You can use the package dplyr
(install via install.packages(dplyr)
):
library(dplyr)
my_data %>% group_by(site) %>% count(year, month)
Output:
# A tibble: 6 x 4
# Groups: site [3]
site year month n
<chr> <dbl> <dbl> <int>
1 a 1991 1 1
2 a 1991 4 2
3 b 1992 1 2
4 b 1992 4 1
5 c 1993 1 2
6 c 1993 4 1
You can post a snippet of your code using dput
:
dput(my_data)
structure(list(site = c("a", "b", "c", "a", "b", "c", "a", "b",
"c"), year = c(1991, 1992, 1993, 1991, 1992, 1993, 1991, 1992,
1993), month = c(1, 1, 4, 4, 1, 1, 4, 4, 1)), class = "data.frame", row.names = c(NA,
-9L))
Then other people can take that the above code and reproduce your data. It doesn't have to be ALL your data, just the first ~10 rows.