activityRatio.Rd
This function takes in data for a recorder and calculates the activity ratio, total duration and number of active days
activityRatio(recorder_name, data, recorder_col = "recorders", date_col = "date_start", summer_days = NULL)
recorder_name | the name of the recorder for whom you want to calculate the metrics |
---|---|
data | the data.frame of recording information |
recorder_col | the name of the column that contains the recorder names |
date_col | the name of the column that contains the date. This must be formatted as a date |
summer_days | Activity ratio is only calculated for the summmer period is this parameter is provided. This is a three column data.frame: year, Jday_start (numeric Julian day of the first day of summer), Jday_end (numeric Julian day of the last day of summer). These are returned as an attribute from |
A data.frame with four columns
recorder
- The name of the recorder, as given in the recorder_name argument
activity_ratio
- The proportion of days on which the volunteer was active in relation to the total days he/she remained linked to the project (i.e. active_days
/ duration
. Duration is either the number of days elapsed from their first to last record, or if summer_days
is provided it is the the number of days elapsed from their first to last record that fall into the summer periods)
total_duration
- The total number of days the volunteer was involved in the project, calculated as the number of days from the first record they submitted to the last (inclusive)
active_days
- The total number of unique dates on which observations were made
# NOT RUN { # load example data head(cit_sci_data) # Get the summer period SD <- summerData(cit_sci_data, date_col = 'date') ar <- activityRatio(recorder_name = 3007, data = cit_sci_data, recorder_col = 'recorder', date_col = 'date', summer_days = attr(SD, 'cutoffs')) # Run the metric for all recorders ar_all <- lapply(unique(cit_sci_data$recorder), FUN = activityRatio, data = cit_sci_data, recorder_col = 'recorder', date_col = 'date', summer_days = attr(SD, 'cutoffs')) # summarise as one table ar_all_sum <- do.call(rbind, ar_all) hist(ar_all_sum$active_days, breaks = 80) # }