Description Usage Arguments Details Value See Also Examples
View source: R/summarize_temperature.R
Uses daily site data to calculate summary temperature statistics for an annual season.
1 2 3 4 5 6 7 8 9 10 11 12 13 | summarize_temperature(
temperature,
start_month,
end_month,
start_day = 15,
end_day = start_day,
growbase_low = 10,
growbase_high = 30,
na.rm = TRUE,
wide = TRUE,
id_index = 1,
date_sep = "_"
)
|
temperature |
data frame with daily temperature data for each site |
start_month |
numeric starting month defining season (inclusive) |
end_month |
numeric ending month defining season (inclusive) |
start_day |
numeric day of starting month defining season (inclusive) |
end_day |
numeric day of ending month defining season (inclusive);
defaults to |
growbase_low |
numeric lower bound for calculating growing degree days (inclusive) |
growbase_high |
numeric upper bound for calculating growing degree days (inclusive) |
na.rm |
logical passed to summary statistic functions indicating
treatment of |
wide |
logical indicating whether or not to output as wide- formatted data |
id_index |
integer column index of unique site id |
date_sep |
character used to delimit variable prefix from date in column names; defaults to underscore ("_") |
User-defined seasons will be, at most, one year long, defined by the
start_*
and end_*
parameters. Seasons can span across
the new year, e.g. a season can start in November and end in March. Seasons
are enumerated by the year in which they start; i.e. if a season starts in
November and ends in March, the output for year YYYY will be based on the
data from November and December of YYYY and January, February, and March of
YYYY + 1.
By default, will return data in "long" format, with a column indicating the
year the data correspond to (but see discussion of season enumeration above).
If wide = TRUE
, output will include a separate column for each
statistic for each year (see Value). For example, if wide =
FALSE
and the data include daily measurements from 1997 to 2002, the output
will have a column year
and a column mean_season
. For these
same data, if wide = TRUE
, there will be no year
column, but
instead it will contain columns mean_season_1997
,
mean_season_1998
...mean_season_2002
.
tibble with temperature summary statistics
If wide = FALSE
, returns values for each year for each site:
Mean temperature for the season
Median temperature for the season
Standard deviation of temperature for the season
Skew of temperatures for the season, where skew is defined by (mean - median)/sd
Maximum temperature over the season
Number growing degree days, defined as days with recorded
temperature between growbase_low
and growbase_high
,
inclusive
Number of days with temperature in the first quintile (0-20th percentile)
Number of days with temperature in the second quintile (20-40th percentile)
Number of days with temperature in the third quintile (40-60th percentile)
Number of days with temperature in the fourth quintile (60-80th percentile)
Number of days with temperature in the fifth quintile (80-100th percentile)
Mean growing degree days across all seasons
Standard deviation of growing degree days across all seasons
Seasonal deviation from the mean number of growing degree days across all seasons
Difference between the number of growing degree days in a
season and the mean number of growing degree days across all seasons,
divided by sd_gdd
If wide = TRUE
, all columns except mean_gdd
and sd_gdd
are replaced with one column for each year. For example, if the data include
daily measurements from 1997 to 2002, there will be no mean_season
column in the output, but will instead have columns mean_season_1997
,
mean_season_1998
...mean_season_2002
.
summarize_rainfall
, par_summarize_temperature
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# Season defined by 15 March through 15 November
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
start_month = 3,
end_month = 11)
# As example above, but output in "long" format
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
start_month = 3,
end_month = 11,
wide = FALSE)
# Season defined by 30 November through 15 March
temperature_summary <- summarize_temperature(temperature = temperature_2yr,
start_month = 11,
end_month = 3,
start_day = 30,
end_day = 15)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.