Title: | Forest Fire History Analysis |
Version: | 0.6.1 |
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>. |
URL: | https://github.com/ltrr-arizona-edu/burnr/ |
BugReports: | https://github.com/ltrr-arizona-edu/burnr/issues |
Depends: | R (≥ 3.2) |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
LazyData: | true |
Suggests: | testthat, knitr, rmarkdown |
Imports: | forcats, ggplot2, MASS, plyr, reshape2, rlang, stats, stringr, tidyr |
RoxygenNote: | 7.1.2 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2022-03-01 05:53:08 UTC; sbm |
Author: | Steven Malevich |
Maintainer: | Steven Malevich <sbmalev@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-03-01 10:10:06 UTC |
Concatenate or combine two fhx objects
Description
Concatenate or combine two fhx objects
Usage
## S3 method for class 'fhx'
a + b
Arguments
a |
An |
b |
The |
Value
An fhx
object with the observations from a
and b
.
Note
Throws stop()
if there are duplicate series names in a
and b
.
See Also
-
series_names()
get all the series in anfhx
object. -
get_series()
subset anfhx
object to select series. -
delete()
remove observations from anfhx
object. -
sort.fhx()
sort anfhx
object.
Examples
data(lgr2)
data(pgm)
plot(lgr2 + pgm)
Alias to as_fhx()
Description
Alias to as_fhx()
Usage
as.fhx(x)
Arguments
x |
A data frame or list-like object to cast. Must have named elements for "year", "series", and "rec_type". |
Value
x
cast to an fhx
object.
See Also
-
fhx()
constructs anfhx
object. -
is_fhx()
test whether object isfhx
. -
make_rec_type()
helpful to convertrec_type
-like character vectors to full facors with proper levels.
Examples
data(lgr2)
example_dataframe <- as.data.frame(lgr2)
back_to_fhx <- as_fhx(example_dataframe)
Cast data frame or list-like to fhx
object
Description
Cast data frame or list-like to fhx
object
Usage
as_fhx(x)
Arguments
x |
A data frame or list-like object to cast. Must have named elements for "year", "series", and "rec_type". |
Value
x
cast to an fhx
object.
See Also
-
fhx()
constructs anfhx
object. -
is_fhx()
test whether object isfhx
. -
make_rec_type()
helpful to convertrec_type
-like character vectors to full facors with proper levels.
Examples
data(lgr2)
example_dataframe <- as.data.frame(lgr2)
back_to_fhx <- as_fhx(example_dataframe)
Composite fire events in fhx object
Description
Composite fire events in fhx object
Usage
composite(
x,
filter_prop = 0.25,
filter_min_rec = 2,
filter_min_events = 1,
injury_event = FALSE,
comp_name = "COMP"
)
Arguments
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 |
Value
An fhx
object representing the composited series. The object will
be empty if there are nocomposite-worthy events.
See Also
-
intervals()
fire interval analysis from anfhx
composite. -
sea()
superposed epoch analysis. -
series_stats()
basic summary stats for anfhx
object. -
get_event_years()
gets years for various events in anfhx
object. -
count_event_position()
count the number of different events in anfhx
object. -
yearly_recording()
count the number of "recording" events in each year of anfhx
object. -
fhx()
constructs anfhx
object. -
as_fhx()
casts data frame-like object into anfhx
object.
Examples
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)
Count different events in an fhx
object
Description
Count different events in an fhx
object
Usage
count_event_position(
x,
injury_event = FALSE,
position,
drop_unknown = FALSE,
groupby
)
Arguments
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. |
Value
A data frame with a columns giving the event or event group and values giving the corresponding count for each event type or group.
See Also
-
get_event_years()
gets years for various events in anfhx
object. *yearly_recording()
count the number of "recording" events in each year of anfhx
object. *series_stats()
basic summary stats for anfhx
object.
Examples
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':"
Number of injury events in an fhx
object
Description
Number of injury events in an fhx
object
Usage
count_injury(x)
Arguments
x |
An |
Value
The number of injury events in x
See Also
-
count_scar()
Count the injuries in anfhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Number of recording years in an fhx
object
Description
Number of recording years in an fhx
object
Usage
count_recording(x, injury_event = FALSE)
Arguments
x |
An |
injury_event |
Boolean indicating whether injuries should be considered event. |
Value
The number of recording events in x
.
See Also
series_stats()
basic statistics for series in an fhx
object.
Number of scar events in an fhx
object
Description
Number of scar events in an fhx
object
Usage
count_scar(x)
Arguments
x |
An |
Value
The number of fire scar events in x
See Also
-
count_injury()
Count the injuries in anfhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Number of years of an fhx
object
Description
Number of years of an fhx
object
Usage
count_year_span(x)
Arguments
x |
An |
Value
The difference between the first and last observations in the fhx
object. NA
will be returned if NA
is in x$year
.
See Also
-
first_year()
get first year offhx
object. -
last_year()
get last year offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Remove series or years from an fhx
object
Description
Remove series or years from an fhx
object
Usage
delete(x, s, yr)
Arguments
x |
An |
s |
Character vector of series to remove from |
yr |
Integer vector of years to remove from |
Details
You can combine s
and yr
to specify years within select series to remove.
Value
An fhx object
with observations removed.
See Also
-
fhx()
constructs anfhx
object. -
as_fhx()
casts data frame-like object into anfhx
object. -
series_names()
get all the series in anfhx
object. -
year_range()
get earliest and latest year in anfhx
object. -
get_year()
subset anfhx
object to select years. -
get_series()
subset anfhx
object to select series. -
get_event_years()
gets years for various events in anfhx
object.
Examples
data(lgr2)
plot(delete(lgr2, s = "LGR46"))
plot(delete(lgr2, yr = 1300:1550))
Constructor for fhx
objects
Description
Constructor for fhx
objects
Usage
fhx(year, series, rec_type)
Arguments
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 |
Details
Note that 'year', 'series', and 'rec_type' are pass through as.numeric()
,
as.factor()
, and make_rec_type()
the fhx
object is created.
Value
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.
See Also
-
as_fhx()
casts data frame-like object intofhx
object. -
sort.fhx()
sort anfhx
object. -
is_fhx()
test whether object isfhx
. -
+.fhx()
concatenate multiplefhx
objects together. -
make_rec_type()
helpful to convertrec_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 offhx
objects. -
series_stats()
basic common statistical summaries offhx
objects. -
composite()
create fire composites fromfhx
objects. -
intervals()
fire interval analysis. -
sea()
superposed epoch analysis.
Examples
x <- fhx(
year = c(1900, 1954, 1996),
series = rep("tree1", 3),
rec_type = c("pith_year", "unknown_fs", "bark_year")
)
print(x)
First (earliest) year of an fhx
object
Description
First (earliest) year of an fhx
object
Usage
first_year(x)
Arguments
x |
An |
Value
The minimum or first year of series in x
.
See Also
-
last_year()
get last year offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Get years with events for an fhx
object
Description
Get years with events for an fhx
object
Usage
get_event_years(
x,
scar_event = TRUE,
injury_event = FALSE,
custom_grep_str = NULL
)
Arguments
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 |
Value
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.
See Also
-
series_names()
get all the series in anfhx
object. -
year_range()
get earliest and latest year in anfhx
object. -
get_year()
subset anfhx
object to select years. -
get_series()
subset anfhx
object to select series. -
get_event_years()
gets years for various events in anfhx
object. -
count_event_position()
count the number of different events in anfhx
object. -
yearly_recording()
count the number of "recording" events in each year of anfhx
object. -
series_stats()
basic summary stats for anfhx
object.
Examples
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)
Extract fhx
observations for given series
Description
Extract fhx
observations for given series
Usage
get_series(x, s)
Arguments
x |
An |
s |
Character vector of series to extract from |
Value
An fhx
object.
See Also
-
series_names()
get all the series in anfhx
object. -
get_year()
subset anfhx
object to select years -
delete()
remove observations from anfhx
object.
Examples
data(lgr2)
get_series(lgr2, "LGR46")
get_series(lgr2, c("LGR41", "LGR46"))
Extract fhx
observations for given years
Description
Extract fhx
observations for given years
Usage
get_year(x, yr)
Arguments
x |
An |
yr |
Numeric vector of year(s) to extract from |
Value
An fhx
object.
See Also
-
year_range()
get earliest and latest year in anfhx
object. -
get_series()
subset anfhx
object to select series. -
delete()
remove observations from anfhx
object. -
get_event_years()
gets years for various events in anfhx
object.
Examples
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)
Type of observation in the first (earliest) year of an fhx
object
Description
Type of observation in the first (earliest) year of an fhx
object
Usage
inner_type(x)
Arguments
x |
An |
Value
The a factor giving the type of observation in the first observation
of x
.
See Also
-
outer_type()
get observation type in outer-most year offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Calculate fire intervals from a composite
Description
Calculate fire intervals from a composite
Usage
intervals(comp, densfun = "weibull")
Arguments
comp |
A |
densfun |
String giving desired distribution to fit. Either "weibull" or "lognormal". Default is "weibull". |
Value
An intervals
object. intervals
have components:
"intervals" an integer vector giving the actual fire intervals.
"fitdistr" a
fitdistr
object fromMASS::fitdistr()
representing the density function fit."densfun" a string giving the name of the density function used.
"kstest" an
htest
object fromstats::ks.test()
giving the result of a one-sample Kolmogorov-Smirnov test."shapirotest" an
htest
object fromstats::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.
See Also
-
composite()
to create acomposite
object. -
mean.intervals()
gets mean fire interval. -
median.intervals()
gets median fire interval. -
quantile.intervals()
get fit distribution quantiles. -
plot_intervals_dist()
plotsintervals
. -
min.intervals()
gives the minimum fire interval. -
max.intervals()
gives the maximum fire interval. -
print.intervals()
prints common fire-interval summary statistics.
Examples
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)
Alias to is_fhx()
Description
Alias to is_fhx()
Usage
is.fhx(x)
Arguments
x |
An object. |
Value
Boolean indicating whether x
is an fhx
object.
See Also
-
fhx()
constructs anfhx
object. -
as_fhx()
casts data frame-like object into anfhx
object. -
+.fhx()
concatenate multiplefhx
objects together.
Examples
data(lgr2)
is_fhx(lgr2)
Alias to is_intervals()
Description
Alias to is_intervals()
Usage
is.intervals(x)
Arguments
x |
An R object. |
Value
Boolean indicating whether x is an intervals
object.
See Also
intervals()
creates an intervals
object.
Alias to is_sea()
Description
Alias to is_sea()
Usage
is.sea(x)
Arguments
x |
An R object. |
Value
Boolean indicating whether x
is a sea
object.
See Also
sea()
creates a sea
object.
Check if object is fhx
.
Description
Check if object is fhx
.
Usage
is_fhx(x)
Arguments
x |
An object. |
Value
Boolean indicating whether x
is an fhx
object.
See Also
-
fhx()
constructs anfhx
object. -
as_fhx()
casts data frame-like object into anfhx
object. -
+.fhx()
concatenate multiplefhx
objects together.
Examples
data(lgr2)
is_fhx(lgr2)
Check if object is fire intervals
Description
Check if object is fire intervals
Usage
is_intervals(x)
Arguments
x |
An R object. |
Value
Boolean indicating whether x is an intervals
object.
See Also
intervals()
creates an intervals
object.
Check if object is sea
Description
Check if object is sea
Usage
is_sea(x)
Arguments
x |
An R object. |
Value
Boolean indicating whether x
is a sea
object.
See Also
sea()
creates a sea
object.
Last (most recent) year of an fhx
object
Description
Last (most recent) year of an fhx
object
Usage
last_year(x)
Arguments
x |
An |
Value
The maximum or last year of series in x
. NA
will be returned if
NA
is in x$year
.
See Also
-
first_year()
get first year offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Los Griegos Peak plot2 fire-history data
Description
An fhx
object with fire-history data from Los Griegos Peak, New Mexico.
Usage
lgr2
Format
An fhx object with 26 series from 1366 to 2012 CE.
See Also
lgr2_meta Los Griegos Peak metadata.
Metadata for the Los Griegos Peak fire-history dataset
Description
A data frame with species information for the Los Griegos Peak plot2 fire-history dataset (lgr2).
Usage
lgr2_meta
Format
A data.frame
with 26 rows and 2 variables:
"TreeID": Name of tree series.
"SpeciesID": Abbreviated tree species
See Also
lgr2 Log Griegos Peak fire-history data.
Turn character vector into factor with proper fhx
levels
Description
Turn character vector into factor with proper fhx
levels
Usage
make_rec_type(x)
Arguments
x |
A character vector or factor containing one or more rec_type-like
strings. This uses a controlled vocabulary, see |
Value
A factor with appropriate fhx
levels.
See Also
Examples
make_rec_type("null_year")
make_rec_type(c("null_year", "late_fs"))
Maximum interval in fire intervals
Description
Maximum interval in fire intervals
Usage
## S3 method for class 'intervals'
max(x, ...)
Arguments
x |
An |
... |
Additional arguments passed to |
Value
Numeric or NA.
See Also
-
intervals()
to create a fireintervals
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.
Fire intervals
arithmetic mean
Description
Fire intervals
arithmetic mean
Usage
## S3 method for class 'intervals'
mean(x, ...)
Arguments
x |
An |
... |
Additional arguments passed to |
Value
Numeric or NA.
See Also
-
intervals()
to create a fireintervals
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.
Fire intervals
median
Description
Fire intervals
median
Usage
## S3 method for class 'intervals'
median(x, ...)
Arguments
x |
An |
... |
Additional arguments passed to |
Value
Numeric or NA.
See Also
-
intervals()
to create a fireintervals
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.
Minimum interval in fire intervals
Description
Minimum interval in fire intervals
Usage
## S3 method for class 'intervals'
min(x, ...)
Arguments
x |
An |
... |
Additional arguments passed to |
Value
Numeric or NA.
See Also
-
intervals()
to create a fireintervals
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.
Type of observation in the last (most recent) year of an fhx
object
Description
Type of observation in the last (most recent) year of an fhx
object
Usage
outer_type(x)
Arguments
x |
An |
Value
The a factor giving the type of observation in the last observation
of x
.
See Also
-
inner_type()
get observation type in inner-most year offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Percent scarred time series for fhx
object
Description
Percent scarred time series for fhx
object
Usage
percent_scarred(x, injury_event = FALSE)
Arguments
x |
An |
injury_event |
Boolean indicating whether years with injury events
should be considered as scars. Default is |
Value
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.
See Also
series_stats()
basic statistics for series in an fhx
object.
Examples
data("pgm")
percent_scarred(pgm)
Peggy Mesa fire-history data
Description
An fhx
object with fire-history data from Peggy Mesa.
Usage
pgm
Format
An fhx
object with 41 series from 1555 to 2013 CE.
Source
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.
See Also
Metadata for the Peggy Mesa fire-history dataset
Description
A data frame with species and location information for the Peggy Mesa fire-history dataset (pgm).
Usage
pgm_meta
Format
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.
Source
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.
See Also
Reconstructed PDSI time series for the Peggy Mesa fire-history dataset
Description
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).
Usage
pgm_pdsi
Format
A data.frame
with 2004 rows and 1 variables. Row names give the
year for the reconstructed value:
"RECON": The reconstructed PDSI series.
Source
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
See Also
Plot an fhx
object
Description
Plot an fhx
object
Usage
## S3 method for class 'fhx'
plot(...)
Arguments
... |
Arguments passed on to |
See Also
plot_demograph()
is what does the actual plotting.
Examples
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
)
Plot a fire intervals
object
Description
Plot a fire intervals
object
Usage
## S3 method for class 'intervals'
plot(...)
Arguments
... |
Arguments passed to |
See Also
plot_intervals_dist()
plot intervals
distributions.
Examples
data(pgm)
interv <- intervals(composite(pgm))
plot(interv, binwidth = 5)
Plot a sea
object
Description
Plot a sea
object
Usage
## S3 method for class 'sea'
plot(...)
Arguments
... |
Arguments passed on to |
See Also
plot_sealags()
handles the plotting for this function.
Examples
## 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)
Create an ggplot2 object for plotting fhx demographics
Description
Create an ggplot2 object for plotting fhx demographics
Usage
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
)
Arguments
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. |
Value
A ggplot
object for plotting or manipulation.
Examples
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
)
Basic fire intervals
distribution plot
Description
Basic fire intervals
distribution plot
Usage
plot_intervals_dist(x, binwidth = NULL)
Arguments
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. |
Value
A ggplot object.
See Also
-
intervals()
to create a fireintervals
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.
Basic SEA lag plot of sea
object
Description
Basic SEA lag plot of sea
object
Usage
plot_sealags(x)
Arguments
x |
A |
Value
A ggplot
object.
See Also
-
sea()
creates asea
object. -
print.sea()
prints a pretty summary of asea
object.
Examples
## 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)
Pajarito Mountain East fire-history data
Description
An fhx
object with fire-history data.
Usage
pme
Format
An fhx
object with 17 series from 1702 to 1993 CE.
Source
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspme001.fhx
Pajarito Mountain Ridge fire-history data
Description
An fhx
object with fire-history data.
Usage
pmr
Format
An fhx
object with 23 series from 1626 to 1993 CE.
Source
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspmr001.fhx
Pajarito Mountain West fire-history data
Description
An fhx
object with fire-history data.
Usage
pmw
Format
An fhx
object with 11 series from 1617 to 1993 CE.
Source
https://www1.ncdc.noaa.gov/pub/data/paleo/firehistory/firescar/northamerica/uspmw001.fhx
Print a fire intervals
object
Description
Print a fire intervals
object
Usage
## S3 method for class 'intervals'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments that are tossed. |
See Also
intervals()
to create a fire intervals
object.
Examples
data(pgm)
interv <- intervals(composite(pgm))
print(interv)
# Note, you can also catch the printed table:
summary_stats <- print(interv)
Print a sea
object.
Description
Print a sea
object.
Usage
## S3 method for class 'sea'
print(x, ...)
Arguments
x |
A |
... |
Additional arguments that are tossed. |
See Also
-
sea()
creates asea
object. -
plot_sealags()
basic plot ofsea
object lags.
Examples
## 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)
Fit distribution quantiles to fire intervals
Description
Fit distribution quantiles to fire intervals
Usage
## S3 method for class 'intervals'
quantile(x, q = c(0.125, 0.5, 0.875), ...)
Arguments
x |
An |
q |
Vector giving the desired quantiles. |
... |
Additional arguments passed to the |
See Also
-
intervals()
to create a fireintervals
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.
Examples
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
Description
Read FHX2 file and return an 'fhx“ object
Usage
read_fhx(fname, encoding, text)
Arguments
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 |
Value
An fhx
object, as returned by fhx()
.
See Also
-
write_fhx()
write anfhx
object to a file. -
fhx()
create anfhx
object. -
as_fhx()
cast data frame or similar object to anfhx
object.
Examples
## Not run:
d <- read_fhx("afile.fhx")
## End(Not run)
Calculate the sample depth of an fhx
object
Description
Calculate the sample depth of an fhx
object
Usage
sample_depth(x)
Arguments
x |
An |
Value
A data frame containing the years and number of observations.
See Also
series_stats()
basic statistics for series in an fhx
object.
Perform superposed epoch analysis
Description
Perform superposed epoch analysis
Usage
sea(x, event, nbefore = 6, nafter = 4, event_range = TRUE, n_iter = 1000)
Arguments
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. |
Details
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.
Value
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.
References
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.
See Also
-
plot_sealags()
plotssea
lags and their statistical significance. -
print.sea()
prints a pretty summary ofsea
objects. -
composite()
creates fire composites, a common input tosea()
.
Examples
## 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)
Calculate quick mean fire interval of an fhx
object with single series
Description
You really should be using intervals()
.
Usage
series_mean_interval(x, injury_event = FALSE)
Arguments
x |
An |
injury_event |
Boolean indicating whether injuries should be considered event. |
Value
The mean fire interval observed x
.
See Also
-
intervals()
Proper way to do fire-interval analysis offhx
object. -
series_stats()
basic statistics for series in anfhx
object.
Get fhx
series names
Description
Get fhx
series names
Usage
series_names(x)
Arguments
x |
An |
Value
A character vector or NULL
.
See Also
-
series_names()
get all the series in anfhx
object. -
get_year()
subset anfhx
object to select years. -
year_range()
get earliest and latest year in anfhx
object. -
get_series()
subset anfhx
object to select series. -
get_event_years()
gets years for various events in anfhx
object. -
count_event_position()
count the number of different events in anfhx
object. -
yearly_recording()
count the number of "recording" events in each year of anfhx
object. -
series_stats()
basic summary stats for anfhx
object.
Examples
data(lgr2)
series_names(lgr2)
Generate series-level descriptive statistics for fhx
object
Description
Generate series-level descriptive statistics for fhx
object
Usage
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)
)
Arguments
x |
An |
func_list |
A list of named functions that will be run on each series
in the |
Value
A data.frame
containing series-level statistics.
See Also
-
fhx()
creates anfhx
object. -
as_fhx()
casts data frame into anfhx
object. -
first_year()
gets earliest year in anfhx
object. -
last_year()
gets latest year in anfhx
object. -
count_year_span()
counts the year span of anfhx
object. -
inner_type()
gets "rec_type" for inner event of anfhx
object. -
outer_type()
get "rec_type" for outside event of anfhx
object. -
count_scar()
counts scars in anfhx
object. -
count_injury()
counts injuries in anfhx
object. -
count_recording()
counts recording years infhx
object. -
series_mean_interval()
quickly estimates mean fire-interval offhx
object. -
sample_depth()
gets sample depth of anfhx
object. -
summary.fhx()
brief summary of anfhx
object. -
composite()
create a firecomposite
from anfhx
object. -
intervals()
get fireintervals
analysis fromcomposite
. -
sea()
superposed epoch analysis.
Examples
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)
Sort the series names of fhx
object by the earliest or latest year
Description
Sort the series names of fhx
object by the earliest or latest year
Usage
## S3 method for class 'fhx'
sort(x, decreasing = FALSE, sort_by = "first_year", ...)
Arguments
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. |
Value
A copy of x
with reordered series.
See Also
-
fhx()
constructs anfhx
object. -
as_fhx()
casts data frame-like object into anfhx
object. -
series_names()
get all the series in anfhx
object. -
delete()
remove observations from anfhx
object. -
+.fhx()
concatenate multiplefhx
objects together.
Examples
data(lgr2)
plot(sort(lgr2, decreasing = TRUE))
plot(sort(lgr2, sort_by = "last_year"))
Summary of fhx
object
Description
Summary of fhx
object
Usage
## S3 method for class 'fhx'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments that are tossed out. |
Value
A summary.fhx
object.
See Also
series_stats()
basic statistics for series in an fhx
object.
Write an fhx
object to a new FHX2 file
Description
Write an fhx
object to a new FHX2 file
Usage
write_fhx(x, fname = "")
Arguments
x |
An |
fname |
Output filename. |
See Also
-
write.csv()
to write a CSV file. Also works onfhx
objects. -
read_fhx()
to read an FHX2 file.
Examples
## Not run:
data(lgr2)
write_fhx(lgr2, "afile.fhx")
## End(Not run)
Range of years in an fhx
object
Description
Range of years in an fhx
object
Usage
year_range(x)
Arguments
x |
An |
Value
A numeric vector or NULL
.
See Also
-
series_names()
get all the series in anfhx
object. -
get_year()
subset anfhx
object to select years. -
get_series()
subset anfhx
object to select series. -
get_event_years()
gets years for various events in anfhx
object. -
count_event_position()
count the number of different events in anfhx
object. -
yearly_recording()
count the number of "recording" events in each year of anfhx
object. -
series_stats()
basic summary stats for anfhx
object.
Examples
data(lgr2)
year_range(lgr2)
Count the number of recording series for each year in an fhx
object
Description
Count the number of recording series for each year in an fhx
object
Usage
yearly_recording(x, injury_event = FALSE)
Arguments
x |
An |
injury_event |
Boolean indicating whether injuries should be considered
events. Default is |
Value
A data frame with columns giving the year and recording events count.
Examples
data(lgr2)
yearly_recording(lgr2)