| Title: | Forest Fire History Analysis |
|---|---|
| Description: | Tools to read, write, parse, and analyze forest fire history data (e.g. FHX). Described in Malevich et al. (2018) <doi:10.1016/j.dendro.2018.02.005>. |
| Authors: | Steven Malevich [aut, cre] (ORCID: <https://orcid.org/0000-0002-4752-8190>), Christopher Guiterman [aut, ctb] (ORCID: <https://orcid.org/0000-0002-9706-9332>), Ellis Margolis [aut] (ORCID: <https://orcid.org/0000-0002-0595-9005>) |
| Maintainer: | Steven Malevich <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.6.1.9000 |
| Built: | 2026-05-28 08:36:03 UTC |
| Source: | https://github.com/ltrr-arizona-edu/burnr |
Concatenate or combine two fhx objects
## S3 method for class 'fhx' a + b## S3 method for class 'fhx' a + b
a |
An |
b |
The |
An fhx object with the observations from a and b.
Throws stop() if there are duplicate series names in a and b.
series_names() get all the series in an fhx object.
get_series() subset an fhx object to select series.
delete() remove observations from an fhx object.
sort.fhx() sort an fhx object.
data(lgr2) data(pgm) plot(lgr2 + pgm)data(lgr2) data(pgm) plot(lgr2 + pgm)
fhx objectCast data frame or list-like to fhx object
as_fhx(x)as_fhx(x)
x |
A data frame or list-like object to cast. Must have named elements for "year", "series", and "rec_type". |
x cast to an fhx object.
fhx() constructs an fhx object.
is_fhx() test whether object is fhx.
make_rec_type() helpful to convert rec_type-like character vectors to
full facors with proper levels.
data(lgr2) example_dataframe <- as.data.frame(lgr2) back_to_fhx <- as_fhx(example_dataframe)data(lgr2) example_dataframe <- as.data.frame(lgr2) back_to_fhx <- as_fhx(example_dataframe)
as_fhx()
Alias to as_fhx()
as.fhx(x)as.fhx(x)
x |
A data frame or list-like object to cast. Must have named elements for "year", "series", and "rec_type". |
x cast to an fhx object.
fhx() constructs an fhx object.
is_fhx() test whether object is fhx.
make_rec_type() helpful to convert rec_type-like character vectors to
full facors with proper levels.
data(lgr2) example_dataframe <- as.data.frame(lgr2) back_to_fhx <- as_fhx(example_dataframe)data(lgr2) example_dataframe <- as.data.frame(lgr2) back_to_fhx <- as_fhx(example_dataframe)
Composite fire events in fhx object
composite( x, filter_prop = 0.25, filter_min_rec = 2, filter_min_events = 1, injury_event = FALSE, comp_name = "COMP" )composite( x, filter_prop = 0.25, filter_min_rec = 2, filter_min_events = 1, injury_event = FALSE, comp_name = "COMP" )
x |
An |
filter_prop |
The minimum proportion of fire events in recording series needed for fire event to be considered for composite. Default is 0.25. |
filter_min_rec |
The minimum number of recording series needed for a fire event to be considered for the composite. Default is 2 recording series. |
filter_min_events |
The minimum number of fire scars needed for a fire
event to be considered for the composite. Default is 1. Fire injuries are
included in this count if |
injury_event |
Boolean indicating whether injuries should be considered
events. Default is |
comp_name |
Character vector of the series name for the returned |
An fhx object representing the composited series. The object will
be empty if there are nocomposite-worthy events.
intervals() fire interval analysis from an fhx composite.
sea() superposed epoch analysis.
series_stats() basic summary stats for an fhx object.
get_event_years() gets years for various events in an fhx object.
count_event_position() count the number of different events in an fhx
object.
yearly_recording() count the number of "recording" events in each year
of an fhx object.
fhx() constructs an fhx object.
as_fhx() casts data frame-like object into an fhx object.
data(lgr2) plot(composite(lgr2)) # Use with composite to get composite years: comp <- composite(pgm, comp_name = "pgm") event_yrs <- get_event_years(comp)[["pgm"]] print(event_yrs)data(lgr2) plot(composite(lgr2)) # Use with composite to get composite years: comp <- composite(pgm, comp_name = "pgm") event_yrs <- get_event_years(comp)[["pgm"]] print(event_yrs)
fhx objectCount different events in an fhx object
count_event_position( x, injury_event = FALSE, position, drop_unknown = FALSE, groupby )count_event_position( x, injury_event = FALSE, position, drop_unknown = FALSE, groupby )
x |
An |
injury_event |
Optional boolean indicating whether injuries should be
considered an "event". Default is |
position |
Depreciated. This allowed users to specify which intra-ring positions to include in the summary output table. The default counts all types of event positions. |
drop_unknown |
Boolean. Defaults to FALSE. If TRUE will remove the "unknown_fs" and/or "unknown_fi" from rec_type. |
groupby |
Optional named list containing character vectors that are used to count the total number of different event types. The names given to each character vector give the group's name in the output data frame. |
A data frame with a columns giving the event or event group and values giving the corresponding count for each event type or group.
get_event_years() gets years for various events in an fhx
object. * yearly_recording() count the number of "recording" events in
each year of an fhx object. * series_stats() basic summary stats for an
fhx object.
data(pgm) count_event_position(pgm) # As above, but considering injuries to be a type of event. count_event_position(pgm, injury_event = TRUE) # Often we only quantify known intra-ring positions. # Remove the "unknown_fs" and/or "unknown_fi" with count_event_position(pgm, drop_unknown = TRUE) # Using custom "groupby" args in a named list, as grplist <- list( foo = c("dormant_fs", "early_fs"), bar = c("middle_fs", "late_fs") ) count_event_position(pgm, groupby = grplist) # Note that if a position in the groupby list is # not included in rec_type, forcats::fct_count() # will throw a flag for an "Unknown levels in 'f':"data(pgm) count_event_position(pgm) # As above, but considering injuries to be a type of event. count_event_position(pgm, injury_event = TRUE) # Often we only quantify known intra-ring positions. # Remove the "unknown_fs" and/or "unknown_fi" with count_event_position(pgm, drop_unknown = TRUE) # Using custom "groupby" args in a named list, as grplist <- list( foo = c("dormant_fs", "early_fs"), bar = c("middle_fs", "late_fs") ) count_event_position(pgm, groupby = grplist) # Note that if a position in the groupby list is # not included in rec_type, forcats::fct_count() # will throw a flag for an "Unknown levels in 'f':"
fhx objectNumber of injury events in an fhx object
count_injury(x)count_injury(x)
x |
An |
The number of injury events in x
count_scar() Count the injuries in an fhx object.
series_stats() basic statistics for series in an fhx object.
fhx objectNumber of recording years in an fhx object
count_recording(x, injury_event = FALSE)count_recording(x, injury_event = FALSE)
x |
An |
injury_event |
Boolean indicating whether injuries should be considered event. |
The number of recording events in x.
series_stats() basic statistics for series in an fhx object.
fhx objectNumber of scar events in an fhx object
count_scar(x)count_scar(x)
x |
An |
The number of fire scar events in x
count_injury() Count the injuries in an fhx object.
series_stats() basic statistics for series in an fhx object.
fhx objectNumber of years of an fhx object
count_year_span(x)count_year_span(x)
x |
An |
The difference between the first and last observations in the fhx
object. NA will be returned if NA is in x$year.
first_year() get first year of fhx object.
last_year() get last year of fhx object.
series_stats() basic statistics for series in an fhx object.
fhx objectRemove series or years from an fhx object
delete(x, s, yr)delete(x, s, yr)
x |
An |
s |
Character vector of series to remove from |
yr |
Integer vector of years to remove from |
You can combine s and yr to specify years within select series to remove.
An fhx object with observations removed.
fhx() constructs an fhx object.
as_fhx() casts data frame-like object into an fhx object.
series_names() get all the series in an fhx object.
year_range() get earliest and latest year in an fhx object.
get_year() subset an fhx object to select years.
get_series() subset an fhx object to select series.
get_event_years() gets years for various events in an fhx object.
data(lgr2) plot(delete(lgr2, s = "LGR46")) plot(delete(lgr2, yr = 1300:1550))data(lgr2) plot(delete(lgr2, s = "LGR46")) plot(delete(lgr2, yr = 1300:1550))
fhx objectsConstructor for fhx objects
fhx(year, series, rec_type)fhx(year, series, rec_type)
year |
An n-length numeric vector of observation years. |
series |
An n-length factor or character vector of observation series names. |
rec_type |
An n-length factor or character vector denoting the record
type for each observations. Note that this needs to use a controlled
vocabulary, see |
Note that 'year', 'series', and 'rec_type' are pass through as.numeric(),
as.factor(), and make_rec_type() the fhx object is created.
An fhx object. fhx are S3 objects; specialized data frames with 3
columns:
"year": An n-length numeric vector. The year of an observation.
"series": An n-length factor. Giving the series name for each observation.
"rec_type": An n-length factor with controlled vocabulary and levels. This records the type of ring or record of each observation.
as_fhx() casts data frame-like object into fhx object.
sort.fhx() sort an fhx object.
is_fhx() test whether object is fhx.
+.fhx() concatenate multiple fhx objects together.
make_rec_type() helpful to convert rec_type-like character vectors to
full facors with proper levels.
read_fhx() Read FHX2 files.
write_fhx() Write FHX2 files.
plot_demograph() makes demography plots of fhx objects.
series_stats() basic common statistical summaries of fhx objects.
composite() create fire composites from fhx objects.
intervals() fire interval analysis.
sea() superposed epoch analysis.
x <- fhx( year = c(1900, 1954, 1996), series = rep("tree1", 3), rec_type = c("pith_year", "unknown_fs", "bark_year") ) print(x)x <- fhx( year = c(1900, 1954, 1996), series = rep("tree1", 3), rec_type = c("pith_year", "unknown_fs", "bark_year") ) print(x)
fhx objectFirst (earliest) year of an fhx object
first_year(x)first_year(x)
x |
An |
The minimum or first year of series in x.
last_year() get last year of fhx object.
series_stats() basic statistics for series in an fhx object.
fhx objectGet years with events for an fhx object
get_event_years( x, scar_event = TRUE, injury_event = FALSE, custom_grep_str = NULL )get_event_years( x, scar_event = TRUE, injury_event = FALSE, custom_grep_str = NULL )
x |
An |
scar_event |
Boolean indicating whether years with scar events should be
returned. Default is |
injury_event |
Boolean indicating whether years with injury events
should be returned. Default is |
custom_grep_str |
Character string to pass a custom grep search pattern
to search |
A list. Elements of the list are numeric vectors giving the years
with events for each fhx series. Each element's name reflects the series'
name.
series_names() get all the series in an fhx object.
year_range() get earliest and latest year in an fhx object.
get_year() subset an fhx object to select years.
get_series() subset an fhx object to select series.
get_event_years() gets years for various events in an fhx object.
count_event_position() count the number of different events in an fhx
object.
yearly_recording() count the number of "recording" events in each
year of an fhx object.
series_stats() basic summary stats for an fhx object.
data(pgm) get_event_years(pgm, scar_event = TRUE, injury_event = TRUE) # Passing a custom string to grep. This one identified recorder years: get_event_years(pgm, custom_grep_str = "recorder_") # Use with composite to get composite years: comp <- composite(pgm, comp_name = "pgm") event_yrs <- get_event_years(comp)[["pgm"]] print(event_yrs)data(pgm) get_event_years(pgm, scar_event = TRUE, injury_event = TRUE) # Passing a custom string to grep. This one identified recorder years: get_event_years(pgm, custom_grep_str = "recorder_") # Use with composite to get composite years: comp <- composite(pgm, comp_name = "pgm") event_yrs <- get_event_years(comp)[["pgm"]] print(event_yrs)
fhx observations for given seriesExtract fhx observations for given series
get_series(x, s)get_series(x, s)
x |
An |
s |
Character vector of series to extract from |
An fhx object.
series_names() get all the series in an fhx object.
get_year() subset an fhx object to select years
delete() remove observations from an fhx object.
data(lgr2) get_series(lgr2, "LGR46") get_series(lgr2, c("LGR41", "LGR46"))data(lgr2) get_series(lgr2, "LGR46") get_series(lgr2, c("LGR41", "LGR46"))
fhx observations for given yearsExtract fhx observations for given years
get_year(x, yr)get_year(x, yr)
x |
An |
yr |
Numeric vector of year(s) to extract from |
An fhx object.
year_range() get earliest and latest year in an fhx object.
get_series() subset an fhx object to select series.
delete() remove observations from an fhx object.
get_event_years() gets years for various events in an fhx object.
data(lgr2) get_year(lgr2, 1806) get_year(lgr2, 1805:1807) ## Not run: # Subsetting before/after a specific year requires a # call to year_range(). For example, to extract all observations # prior to 1900, use get_year(lgr2, year_range(lgr2)[1]:1900) ## End(Not run)data(lgr2) get_year(lgr2, 1806) get_year(lgr2, 1805:1807) ## Not run: # Subsetting before/after a specific year requires a # call to year_range(). For example, to extract all observations # prior to 1900, use get_year(lgr2, year_range(lgr2)[1]:1900) ## End(Not run)
fhx objectType of observation in the first (earliest) year of an fhx object
inner_type(x)inner_type(x)
x |
An |
The a factor giving the type of observation in the first observation
of x.
outer_type() get observation type in outer-most year of fhx object.
series_stats() basic statistics for series in an fhx object.
composite
Calculate fire intervals from a composite
intervals(comp, densfun = "weibull")intervals(comp, densfun = "weibull")
comp |
A |
densfun |
String giving desired distribution to fit. Either "weibull" or "lognormal". Default is "weibull". |
An intervals object. intervals have components:
"intervals" an integer vector giving the actual fire intervals.
"fitdistr" a fitdistr object from MASS::fitdistr() representing the
density function fit.
"densfun" a string giving the name of the density function used.
"kstest" an htest object from stats::ks.test() giving the result of a
one-sample Kolmogorov-Smirnov test.
"shapirotest" an htest object from stats::shapiro.test() giving the
result of a Shapiro-Wilk normality test.
"comp_name" a string giving the name of the interval's input composite.
"event_range" an integer vector giving the year range (min, max) of events used to create this intervals.
composite() to create a composite object.
mean.intervals() gets mean fire interval.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
plot_intervals_dist() plots intervals.
min.intervals() gives the minimum fire interval.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
data(pgm) interv <- intervals(composite(pgm)) print(interv) mean(interv) # Mean interval # Now fit log-normal distribution instead of Weibull. intervals(composite(pgm), densfun = "lognormal") ## Not run: # Boxplot of fire interval distribution. boxplot(intervals(composite(pgm))$intervals) ## End(Not run)data(pgm) interv <- intervals(composite(pgm)) print(interv) mean(interv) # Mean interval # Now fit log-normal distribution instead of Weibull. intervals(composite(pgm), densfun = "lognormal") ## Not run: # Boxplot of fire interval distribution. boxplot(intervals(composite(pgm))$intervals) ## End(Not run)
fhx.Check if object is fhx.
is_fhx(x)is_fhx(x)
x |
An object. |
Boolean indicating whether x is an fhx object.
fhx() constructs an fhx object.
as_fhx() casts data frame-like object into an fhx object.
+.fhx() concatenate multiple fhx objects together.
data(lgr2) is_fhx(lgr2)data(lgr2) is_fhx(lgr2)
intervals
Check if object is fire intervals
is_intervals(x)is_intervals(x)
x |
An R object. |
Boolean indicating whether x is an intervals object.
intervals() creates an intervals object.
sea
Check if object is sea
is_sea(x)is_sea(x)
x |
An R object. |
Boolean indicating whether x is a sea object.
sea() creates a sea object.
is_fhx()
Alias to is_fhx()
is.fhx(x)is.fhx(x)
x |
An object. |
Boolean indicating whether x is an fhx object.
fhx() constructs an fhx object.
as_fhx() casts data frame-like object into an fhx object.
+.fhx() concatenate multiple fhx objects together.
data(lgr2) is_fhx(lgr2)data(lgr2) is_fhx(lgr2)
is_intervals()
Alias to is_intervals()
is.intervals(x)is.intervals(x)
x |
An R object. |
Boolean indicating whether x is an intervals object.
intervals() creates an intervals object.
is_sea()
Alias to is_sea()
is.sea(x)is.sea(x)
x |
An R object. |
Boolean indicating whether x is a sea object.
sea() creates a sea object.
fhx objectLast (most recent) year of an fhx object
last_year(x)last_year(x)
x |
An |
The maximum or last year of series in x. NA will be returned if
NA is in x$year.
first_year() get first year of fhx object.
series_stats() basic statistics for series in an fhx object.
An fhx object with fire-history data from Los Griegos Peak, New Mexico.
lgr2lgr2
An fhx object with 26 series from 1366 to 2012 CE.
lgr2_meta Los Griegos Peak metadata.
A data frame with species information for the Los Griegos Peak plot2 fire-history dataset (lgr2).
lgr2_metalgr2_meta
A data.frame with 26 rows and 2 variables:
"TreeID": Name of tree series.
"SpeciesID": Abbreviated tree species
lgr2 Log Griegos Peak fire-history data.
fhx levelsTurn character vector into factor with proper fhx levels
make_rec_type(x)make_rec_type(x)
x |
A character vector or factor containing one or more rec_type-like
strings. This uses a controlled vocabulary, see |
A factor with appropriate fhx levels.
make_rec_type("null_year") make_rec_type(c("null_year", "late_fs"))make_rec_type("null_year") make_rec_type(c("null_year", "late_fs"))
intervals
Maximum interval in fire intervals
## S3 method for class 'intervals' max(x, ...)## S3 method for class 'intervals' max(x, ...)
x |
An |
... |
Additional arguments passed to |
Numeric or NA.
intervals() to create a fire intervals object.
mean.intervals() gets median fire interval.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
min.intervals() gives the minimum fire interval.
print.intervals() prints common fire-interval summary statistics.
intervals arithmetic meanFire intervals arithmetic mean
## S3 method for class 'intervals' mean(x, ...)## S3 method for class 'intervals' mean(x, ...)
x |
An |
... |
Additional arguments passed to |
Numeric or NA.
intervals() to create a fire intervals object.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
min.intervals() gives the minimum fire interval.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
intervals medianFire intervals median
## S3 method for class 'intervals' median(x, ...)## S3 method for class 'intervals' median(x, ...)
x |
An |
... |
Additional arguments passed to |
Numeric or NA.
intervals() to create a fire intervals object.
mean.intervals() gets mean fire interval.
quantile.intervals() get fit distribution quantiles.
min.intervals() gives the minimum fire interval.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
intervals
Minimum interval in fire intervals
## S3 method for class 'intervals' min(x, ...)## S3 method for class 'intervals' min(x, ...)
x |
An |
... |
Additional arguments passed to |
Numeric or NA.
intervals() to create a fire intervals object.
mean.intervals() gets median fire interval.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
fhx objectType of observation in the last (most recent) year of an fhx object
outer_type(x)outer_type(x)
x |
An |
The a factor giving the type of observation in the last observation
of x.
inner_type() get observation type in inner-most year of fhx object.
series_stats() basic statistics for series in an fhx object.
fhx objectPercent scarred time series for fhx object
percent_scarred(x, injury_event = FALSE)percent_scarred(x, injury_event = FALSE)
x |
An |
injury_event |
Boolean indicating whether years with injury events
should be considered as scars. Default is |
data.frame with four columns:
"Year": The year.
"NumRec": The number of recording trees.
"NumScars": Number of fire scars and possibly fire injuries.
"PercScarred": The proportion of scars (and possibly injuries) to non-scar/injury series in the year.
series_stats() basic statistics for series in an fhx object.
data("pgm") percent_scarred(pgm)data("pgm") percent_scarred(pgm)
An fhx object with fire-history data from Peggy Mesa.
pgmpgm
An fhx object with 41 series from 1555 to 2013 CE.
Guiterman, Christopher H., Ellis Q. Margolis, and Thomas W. Swetnam. 2015. "Dendroecological Methods For Reconstructing High-Severity Fire In Pine-Oak Forests." Tree-Ring Research 71 (2): 67-77. doi:10.3959/1536-1098-71.2.67.
A data frame with species and location information for the Peggy Mesa fire-history dataset (pgm).
pgm_metapgm_meta
A data.frame with 41 rows and 5 variables:
"TreeID": Name of tree series.
"SpeciesID": Abbreviated tree species.
"Latitude": latitude of tree in decimal degrees.
"Longitude": longitude of tree in decimal degrees.
"Elevation": tree elevation in meters.
Guiterman, Christopher H., Ellis Q. Margolis, and Thomas W. Swetnam. 2015. "Dendroecological Methods For Reconstructing High-Severity Fire In Pine-Oak Forests." Tree-Ring Research 71 (2): 67-77. doi:10.3959/1536-1098-71.2.67.
A tree-ring reconstructed Palmer Drought-Severity Index time series corresponding to the Peggy Mesa fire-history dataset (pgm) – specifically, the Jemez Mountains area (gridpoint 133). The reconstruction is from The North American Drought Atlas (Cook and Krusic 2004).
pgm_pdsipgm_pdsi
A data.frame with 2004 rows and 1 variables. Row names give the
year for the reconstructed value:
"RECON": The reconstructed PDSI series.
Cook, E. R., and Krusic, P. J. (2004). The North American Drought Atlas. Retrieved September 13, 2017, from http://iridl.ldeo.columbia.edu/SOURCES/.LDEO/.TRL/.NADA2004/.pdsi-atlas.html
Create an ggplot2 object for plotting fhx demographics
plot_demograph( x, color_group, color_id, facet_group, facet_id, facet_type = "grid", ylabels = TRUE, yearlims = FALSE, composite_rug = FALSE, filter_prop = 0.25, filter_min_rec = 2, filter_min_events = 1, injury_event = FALSE, plot_legend = FALSE, event_size = c(Scar = 4, Injury = 2, `Pith/Bark` = 1.5), rugbuffer_size = 2, rugdivide_pos = 2 )plot_demograph( x, color_group, color_id, facet_group, facet_id, facet_type = "grid", ylabels = TRUE, yearlims = FALSE, composite_rug = FALSE, filter_prop = 0.25, filter_min_rec = 2, filter_min_events = 1, injury_event = FALSE, plot_legend = FALSE, event_size = c(Scar = 4, Injury = 2, `Pith/Bark` = 1.5), rugbuffer_size = 2, rugdivide_pos = 2 )
x |
An |
color_group |
Option to plot series with colors. This is a character
vector or factor which corresponds to the series names given in
|
color_id |
Option to plot series with colors. A character vector of
series names corresponding to groups given in |
facet_group |
Option to plot series with faceted by a factor. A vector
of factors or character vector which corresponds to the series names given
in |
facet_id |
Option to plot series with faceted by a factor. A vector of
series names corresponding to species names given in |
facet_type |
Type of ggplot2 facet to use, if faceting. Must be
either "grid" or "wrap". Default is "grid". Note that |
ylabels |
Optional boolean to remove y-axis (series name) labels and tick marks. Default is TRUE. |
yearlims |
Option to limit the plot to a range of years. This is a
vector with two integers. The first integer gives the lower year for the
range while the second integer gives the upper year. The default is to
plot the full range of data given by |
composite_rug |
A boolean option to plot a rug on the bottom of the
plot. Default is FALSE. Note that |
filter_prop |
The minimum proportion of fire events in recording series needed for fire event to be considered for composite. Default is 0.25. |
filter_min_rec |
The minimum number of recording series needed for a fire event to be considered for the composite. Default is 2 recording series. |
filter_min_events |
The minimum number of fire scars needed for a fire
event to be considered for the composite. Default is 1. Fire injuries are
included in this count if |
injury_event |
Boolean indicating whether injuries should be considered
events. Default is |
plot_legend |
A boolean option allowing the user to choose whether a
legend is included in the plot or not. Default is |
event_size |
An optional numeric vector that adjusts the size of fire
event symbols on the plot. Default is
|
rugbuffer_size |
An optional integer. If the user plots a rug, this controls the amount of buffer whitespace along the y-axis between the rug and the main plot. Must be >= 2. |
rugdivide_pos |
Optional integer if plotting a rug. Adjust the placement of the rug divider along the y-axis. Default is 2. |
A ggplot object for plotting or manipulation.
data(lgr2) plot(lgr2) plot(lgr2, ylabels = FALSE, plot_legend = TRUE) data(lgr2_meta) # With color showing species. plot(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID, plot_legend = TRUE ) # With facets for each species. plot(lgr2, facet_group = lgr2_meta$SpeciesID, facet_id = lgr2_meta$TreeID, plot_legend = TRUE ) # Append annotation onto a ggplot object. require(ggplot2) p <- plot_demograph(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID ) # Add transparent box as annotation to plot. p + annotate("rect", xmin = 1750, xmax = 1805, ymin = 3.5, ymax = 13.5, alpha = 0.2 )data(lgr2) plot(lgr2) plot(lgr2, ylabels = FALSE, plot_legend = TRUE) data(lgr2_meta) # With color showing species. plot(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID, plot_legend = TRUE ) # With facets for each species. plot(lgr2, facet_group = lgr2_meta$SpeciesID, facet_id = lgr2_meta$TreeID, plot_legend = TRUE ) # Append annotation onto a ggplot object. require(ggplot2) p <- plot_demograph(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID ) # Add transparent box as annotation to plot. p + annotate("rect", xmin = 1750, xmax = 1805, ymin = 3.5, ymax = 13.5, alpha = 0.2 )
intervals distribution plotBasic fire intervals distribution plot
plot_intervals_dist(x, binwidth = NULL)plot_intervals_dist(x, binwidth = NULL)
x |
An |
binwidth |
The width of the bins. Can be specified as a numeric value
or as a function that calculates width from unscaled x. Here, "unscaled x"
refers to the original x values in the data, before application of any
scale transformation. When specifying a function along with a grouping
structure, the function will be called once per group.
The default is to use the number of bins in The bin width of a date variable is the number of days in each time; the bin width of a time variable is the number of seconds. |
A ggplot object.
intervals() to create a fire intervals object.
mean.intervals() gets mean fire interval.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
min.intervals() gives the minimum fire interval.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
sea objectBasic SEA lag plot of sea object
plot_sealags(x)plot_sealags(x)
x |
A |
A ggplot object.
sea() creates a sea object.
print.sea() prints a pretty summary of a sea object.
## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). data(pgm_pdsi) # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pgm_pdsi, pgm_comp) plot(pgm_sea) ## End(Not run)## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). data(pgm_pdsi) # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pgm_pdsi, pgm_comp) plot(pgm_sea) ## End(Not run)
fhx objectPlot an fhx object
## S3 method for class 'fhx' plot(...)## S3 method for class 'fhx' plot(...)
... |
Arguments passed on to |
plot_demograph() is what does the actual plotting.
data(lgr2) plot(lgr2) plot(lgr2, ylabels = FALSE, plot_legend = TRUE) data(lgr2_meta) # With color showing species. plot(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID, plot_legend = TRUE ) # With facets for each species. plot(lgr2, facet_group = lgr2_meta$SpeciesID, facet_id = lgr2_meta$TreeID, plot_legend = TRUE ) # Append annotation onto a ggplot object. require(ggplot2) p <- plot_demograph(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID ) # Add transparent box as annotation to plot. p + annotate("rect", xmin = 1750, xmax = 1805, ymin = 3.5, ymax = 13.5, alpha = 0.2 )data(lgr2) plot(lgr2) plot(lgr2, ylabels = FALSE, plot_legend = TRUE) data(lgr2_meta) # With color showing species. plot(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID, plot_legend = TRUE ) # With facets for each species. plot(lgr2, facet_group = lgr2_meta$SpeciesID, facet_id = lgr2_meta$TreeID, plot_legend = TRUE ) # Append annotation onto a ggplot object. require(ggplot2) p <- plot_demograph(lgr2, color_group = lgr2_meta$SpeciesID, color_id = lgr2_meta$TreeID ) # Add transparent box as annotation to plot. p + annotate("rect", xmin = 1750, xmax = 1805, ymin = 3.5, ymax = 13.5, alpha = 0.2 )
intervals objectPlot a fire intervals object
## S3 method for class 'intervals' plot(...)## S3 method for class 'intervals' plot(...)
... |
Arguments passed to |
plot_intervals_dist() plot intervals distributions.
data(pgm) interv <- intervals(composite(pgm)) plot(interv, binwidth = 5)data(pgm) interv <- intervals(composite(pgm)) plot(interv, binwidth = 5)
sea objectPlot a sea object
## S3 method for class 'sea' plot(...)## S3 method for class 'sea' plot(...)
... |
Arguments passed on to |
plot_sealags() handles the plotting for this function.
## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). data(pgm_pdsi) # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pgm_pdsi, pgm_comp) plot(pgm_sea) ## End(Not run)## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). data(pgm_pdsi) # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pgm_pdsi, pgm_comp) plot(pgm_sea) ## End(Not run)
An fhx object with fire-history data.
pmepme
An fhx object with 17 series from 1702 to 1993 CE.
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspme001.fhx
An fhx object with fire-history data.
pmrpmr
An fhx object with 23 series from 1626 to 1993 CE.
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspmr001.fhx
An fhx object with fire-history data.
pmwpmw
An fhx object with 11 series from 1617 to 1993 CE.
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspmw001.fhx
intervals objectPrint a fire intervals object
## S3 method for class 'intervals' print(x, ...)## S3 method for class 'intervals' print(x, ...)
x |
An |
... |
Additional arguments that are tossed. |
intervals() to create a fire intervals object.
data(pgm) interv <- intervals(composite(pgm)) print(interv) # Note, you can also catch the printed table: summary_stats <- print(interv)data(pgm) interv <- intervals(composite(pgm)) print(interv) # Note, you can also catch the printed table: summary_stats <- print(interv)
sea object.Print a sea object.
## S3 method for class 'sea' print(x, ...)## S3 method for class 'sea' print(x, ...)
x |
A |
... |
Additional arguments that are tossed. |
sea() creates a sea object.
plot_sealags() basic plot of sea object lags.
## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). target_url <- paste0( "http://iridl.ldeo.columbia.edu", "/SOURCES/.LDEO/.TRL/.NADA2004", "/pdsiatlashtml/pdsiwebdata/1050w_350n_133.txt" ) pdsi <- read.table(target_url, header = TRUE, row.names = 1) pdsi <- subset(pdsi, select = "RECON") # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pdsi, pgm_comp) # See basic results: print(pgm_sea) # Basic plot: plot(pgm_sea) ## End(Not run)## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). target_url <- paste0( "http://iridl.ldeo.columbia.edu", "/SOURCES/.LDEO/.TRL/.NADA2004", "/pdsiatlashtml/pdsiwebdata/1050w_350n_133.txt" ) pdsi <- read.table(target_url, header = TRUE, row.names = 1) pdsi <- subset(pdsi, select = "RECON") # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pdsi, pgm_comp) # See basic results: print(pgm_sea) # Basic plot: plot(pgm_sea) ## End(Not run)
intervals
Fit distribution quantiles to fire intervals
## S3 method for class 'intervals' quantile(x, q = c(0.125, 0.5, 0.875), ...)## S3 method for class 'intervals' quantile(x, q = c(0.125, 0.5, 0.875), ...)
x |
An |
q |
Vector giving the desired quantiles. |
... |
Additional arguments passed to the |
intervals() to create a fire intervals object.
mean.intervals() gets median fire interval.
median.intervals() gets median fire interval.
quantile.intervals() get fit distribution quantiles.
min.intervals() gives the minimum fire interval.
max.intervals() gives the maximum fire interval.
print.intervals() prints common fire-interval summary statistics.
data(pgm) intervs <- intervals(composite(pgm)) quantile(intervs) # Or you can pass in your own quantiles: quantile(intervs, q = c(0.25, 0.5, 0.75))data(pgm) intervs <- intervals(composite(pgm)) quantile(intervs) # Or you can pass in your own quantiles: quantile(intervs, q = c(0.25, 0.5, 0.75))
Read FHX2 file and return an 'fhx“ object
read_fhx(fname, encoding, text)read_fhx(fname, encoding, text)
fname |
Name of target FHX file. Needs to be in format version 2. |
encoding |
Encoding to use when reading the FHX file. The default is to use the system default in R. |
text |
Character string. If |
An fhx object, as returned by fhx().
write_fhx() write an fhx object to a file.
fhx() create an fhx object.
as_fhx() cast data frame or similar object to an fhx object.
## Not run: d <- read_fhx("afile.fhx") ## End(Not run)## Not run: d <- read_fhx("afile.fhx") ## End(Not run)
fhx objectCalculate the sample depth of an fhx object
sample_depth(x)sample_depth(x)
x |
An |
A data frame containing the years and number of observations.
series_stats() basic statistics for series in an fhx object.
Perform superposed epoch analysis
sea(x, event, nbefore = 6, nafter = 4, event_range = TRUE, n_iter = 1000)sea(x, event, nbefore = 6, nafter = 4, event_range = TRUE, n_iter = 1000)
x |
A data frame climate reconstruction or tree-ring series with row names as years, and one numeric variable. |
event |
An numeric vector of event years for superposed epoch, such as
fire years, or an |
nbefore |
The number of lag years prior to the event year. |
nafter |
The number of lag years following the event year. |
event_range |
Logical. Constrain the time series to the time period of
key events within the range of the |
n_iter |
The number of iterations for bootstrap resampling. |
Superposed epoch analysis (SEA) helps to evaluate fire-climate
relationships in studies of tree-ring fire history. It works by compositing
the values of an annual time series or climate reconstruction for the fire
years provided (event) and both positive and negative lag years.
Bootstrap resampling of the time series is performed to evaluate the
statistical significance of each year's mean value. Users interpret the
departure of the actual event year means from the simulated event year means.
Note that there is no rescaling of the climate time series x.
The significance of lag-year departures from the average climate condition was first noted by Baisan and Swetnam (1990) and used in an organized SEA by Swetnam (1993). Since then, the procedure has been commonly applied in fire history studies. The FORTRAN program EVENT.exe was written by Richard Holmes and Thomas Swetnam (Holmes and Swetnam 1994) to perform SEA for fire history specifically. EVENT was incorporated in the FHX2 software by Henri Grissino-Mayer. Further information about SEA can be found in the FHAES user's manual, http://help.fhaes.org/.
sea() was originally designed to replicate EVENT as closely as possible. We
have tried to stay true to their implementation of SEA, although multiple
versions of the analysis exist in the climate literature and for fire
history. The outcome of EVENT and sea should only differ slightly in the
values of the simulated events and the departures, because random draws are
used. The event year and lag significance levels should match, at least in
the general pattern.
Our SEA implementation borrowed from dplR::sea() function in how it
performs the bootstrap procedure, but differs in the kind of output provided
for the user.
A sea object containing. This contains:
"event_years": a numeric vector of event years.
"actual": a data.frame summary of the actual events.
"random": a data.frame summary of the bootstrapped events.
"departure": a data.frame summary of the departures of actual from
bootstrapped events.
"simulated": a full 2D matrix of the bootstrapped-values across lags.
"observed": a ful 2D matrix of "actual" events across lags.
Baisan and Swetnam 1990, Fire history on desert mountain range: Rincon Mountain Wilderness, Arizona, U.S.A. Canadian Journal of Forest Research 20:1559-1569.
Bunn 2008, A dendrochronology program library in R (dplR), Dendrochronologia 26:115-124
Holmes and Swetnam 1994, EVENT program description
Swetnam 1993, Fire history and climate change in giant sequoia groves, Science 262:885-889.
plot_sealags() plots sea lags and their statistical significance.
print.sea() prints a pretty summary of sea objects.
composite() creates fire composites, a common input to sea().
## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). target_url <- paste0( "http://iridl.ldeo.columbia.edu", "/SOURCES/.LDEO/.TRL/.NADA2004", "/pdsiatlashtml/pdsiwebdata/1050w_350n_133.txt" ) pdsi <- read.table(target_url, header = TRUE, row.names = 1) pdsi <- subset(pdsi, select = "RECON") # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pdsi, pgm_comp) # See basic results: print(pgm_sea) # Basic plot: plot(pgm_sea) ## End(Not run)## Not run: # Read in the Cook and Krusic (2004; The North American Drought Atlas) # reconstruction of Palmer Drought Severity Index (PDSI) for the Jemez # Mountains area (gridpoint 133). target_url <- paste0( "http://iridl.ldeo.columbia.edu", "/SOURCES/.LDEO/.TRL/.NADA2004", "/pdsiatlashtml/pdsiwebdata/1050w_350n_133.txt" ) pdsi <- read.table(target_url, header = TRUE, row.names = 1) pdsi <- subset(pdsi, select = "RECON") # Run SEA on Peggy Mesa (pgm) data data(pgm) pgm_comp <- composite(pgm) pgm_sea <- sea(pdsi, pgm_comp) # See basic results: print(pgm_sea) # Basic plot: plot(pgm_sea) ## End(Not run)
fhx object with single seriesYou really should be using intervals().
series_mean_interval(x, injury_event = FALSE)series_mean_interval(x, injury_event = FALSE)
x |
An |
injury_event |
Boolean indicating whether injuries should be considered event. |
The mean fire interval observed x.
intervals() Proper way to do fire-interval analysis of fhx object.
series_stats() basic statistics for series in an fhx object.
fhx series namesGet fhx series names
series_names(x)series_names(x)
x |
An |
A character vector or NULL.
series_names() get all the series in an fhx object.
get_year() subset an fhx object to select years.
year_range() get earliest and latest year in an fhx object.
get_series() subset an fhx object to select series.
get_event_years() gets years for various events in an fhx object.
count_event_position() count the number of different events in an fhx
object.
yearly_recording() count the number of "recording" events in each year
of an fhx object.
series_stats() basic summary stats for an fhx object.
data(lgr2) series_names(lgr2)data(lgr2) series_names(lgr2)
fhx objectGenerate series-level descriptive statistics for fhx object
series_stats( x, func_list = list(first = first_year, last = last_year, years = count_year_span, inner_type = inner_type, outer_type = outer_type, number_scars = count_scar, number_injuries = count_injury, recording_years = count_recording, mean_interval = series_mean_interval) )series_stats( x, func_list = list(first = first_year, last = last_year, years = count_year_span, inner_type = inner_type, outer_type = outer_type, number_scars = count_scar, number_injuries = count_injury, recording_years = count_recording, mean_interval = series_mean_interval) )
x |
An |
func_list |
A list of named functions that will be run on each series
in the |
A data.frame containing series-level statistics.
fhx() creates an fhx object.
as_fhx() casts data frame into an fhx object.
first_year() gets earliest year in an fhx object.
last_year() gets latest year in an fhx object.
count_year_span() counts the year span of an fhx object.
inner_type() gets "rec_type" for inner event of an fhx object.
outer_type() get "rec_type" for outside event of an fhx object.
count_scar() counts scars in an fhx object.
count_injury() counts injuries in an fhx object.
count_recording() counts recording years in fhx object.
series_mean_interval() quickly estimates mean fire-interval of fhx
object.
sample_depth() gets sample depth of an fhx object.
summary.fhx() brief summary of an fhx object.
composite() create a fire composite from an fhx object.
intervals() get fire intervals analysis from composite.
sea() superposed epoch analysis.
data(lgr2) series_stats(lgr2) # You can create your own list of statistics to output. You can also create # your own functions: flist <- list( n = count_year_span, xbar_interval = function(x) mean_interval(x, injury_event = TRUE) ) sstats <- series_stats(lgr2) head(sstats)data(lgr2) series_stats(lgr2) # You can create your own list of statistics to output. You can also create # your own functions: flist <- list( n = count_year_span, xbar_interval = function(x) mean_interval(x, injury_event = TRUE) ) sstats <- series_stats(lgr2) head(sstats)
fhx object by the earliest or latest yearSort the series names of fhx object by the earliest or latest year
## S3 method for class 'fhx' sort(x, decreasing = FALSE, sort_by = "first_year", ...)## S3 method for class 'fhx' sort(x, decreasing = FALSE, sort_by = "first_year", ...)
x |
An |
decreasing |
Logical. Decreasing sorting? Defaults to |
sort_by |
Either "first_year" or "last_year". Designates the inner or outer year for sorting. Defaults to "first_year" |
... |
Additional arguments that fall off the face of the universe. |
A copy of x with reordered series.
fhx() constructs an fhx object.
as_fhx() casts data frame-like object into an fhx object.
series_names() get all the series in an fhx object.
delete() remove observations from an fhx object.
+.fhx() concatenate multiple fhx objects together.
data(lgr2) plot(sort(lgr2, decreasing = TRUE)) plot(sort(lgr2, sort_by = "last_year"))data(lgr2) plot(sort(lgr2, decreasing = TRUE)) plot(sort(lgr2, sort_by = "last_year"))
fhx objectSummary of fhx object
## S3 method for class 'fhx' summary(object, ...)## S3 method for class 'fhx' summary(object, ...)
object |
An |
... |
Additional arguments that are tossed out. |
A summary.fhx object.
series_stats() basic statistics for series in an fhx object.
fhx object to a new FHX2 fileWrite an fhx object to a new FHX2 file
write_fhx(x, fname = "")write_fhx(x, fname = "")
x |
An |
fname |
Output filename. |
write.csv() to write a CSV file. Also works on fhx objects.
read_fhx() to read an FHX2 file.
## Not run: data(lgr2) write_fhx(lgr2, "afile.fhx") ## End(Not run)## Not run: data(lgr2) write_fhx(lgr2, "afile.fhx") ## End(Not run)
fhx objectRange of years in an fhx object
year_range(x)year_range(x)
x |
An |
A numeric vector or NULL.
series_names() get all the series in an fhx object.
get_year() subset an fhx object to select years.
get_series() subset an fhx object to select series.
get_event_years() gets years for various events in an fhx object.
count_event_position() count the number of different events in an fhx
object.
yearly_recording() count the number of "recording" events in each year
of an fhx object.
series_stats() basic summary stats for an fhx object.
data(lgr2) year_range(lgr2)data(lgr2) year_range(lgr2)
fhx objectCount the number of recording series for each year in an fhx object
yearly_recording(x, injury_event = FALSE)yearly_recording(x, injury_event = FALSE)
x |
An |
injury_event |
Boolean indicating whether injuries should be considered
events. Default is |
A data frame with columns giving the year and recording events count.
data(lgr2) yearly_recording(lgr2)data(lgr2) yearly_recording(lgr2)