Description Usage Arguments Value Examples
View source: R/stats_by_group.R
Calculate summary and spatial statistics across multiple images within groups.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
img_list |
List or stack of numeric temperature matrices or rasters. |
metadata |
A dataframe denoting the grouping of different images.
Defaults to NULL as this is not required when |
idvar |
Name of the metadata variable that identifies unique
images. Should match element names in the image list. Defaults to NULL as
this is not required when |
grouping_var |
The name of the metadata variable that denotes the
grouping of images. Defaults to NULL, where it is assumed to equal |
round_val |
Value to round to. Defaults to NULL. |
calc_connectivity |
Whether or not to calculate thermal connectivity across pixels (slow for large rasters). Defaults to FALSE. |
conn_threshold |
Climate threshold to use for calculation of thermal
connectivity (i.e. the amount of change that organisms would be seeking
to avoid). See |
patches |
Whether to identify hot and cold spots. Defaults to TRUE. |
style |
Style to use when calculating neighbourhood weights using
|
img_proj |
Spatial projection. Optional, but necessary for geographic data to plot correctly. |
img_extent |
Spatial extent. Optional, but necessary for geographic data to plot correctly. |
sum_stats |
Summary statistics that should be calculated across
all pixels. Several helper functions are included for use here:
|
return_vals |
Which values to return? Any combination of the dataframe
( |
A list containing:
df |
A dataframe with one row for each pixel, and variables denoting:
the pixel value (val); the spatial location of the pixel (x and y);
its patch classification (G_bin) into a hot (1), cold (-1) or no patch (0)
according to the Z value (see If calculating thermal connectivity, |
patches |
A list of SpatialPolygonsDataFrames of hot and cold patches,
named according to |
pstats |
A dataframe with patch statistics for hot patches and cold
patches, respectively. See If calculating thermal connectivity, there will also be statistics for
the minimum, mean, median and maximum temperature difference
( |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # Load raw data
raw_dat <- flir_raw$raw_dat
camera_params <- flir_raw$camera_params
metadata <- flir_metadata
# Batch convert
img_list <- batch_convert(raw_dat, write_results = FALSE)
## Not run:
# Calculate patch and pixel stats -------------------------------------------
# Pixel stats = mean, max and min
patch_stats_1 <-
stats_by_group(img_list = img_list,
metadata = metadata,
idvar = "photo_no",
style = "C",
grouping_var = "rep_id",
round_val = 0.5,
sum_stats = c("mean", "max", "min"))
# Pixel stats = kurtosis and sknewness
patch_stats_2 <-
stats_by_group(img_list = img_list,
metadata = metadata,
idvar = "photo_no",
style = "C",
grouping_var = "rep_id",
round_val = 0.5,
sum_stats = c("kurtosis", "skewness"))
# Pixel stats = 5th and 95th percentiles
patch_stats_3 <-
stats_by_group(img_list = img_list,
metadata = metadata,
idvar = "photo_no",
style = "C",
grouping_var = "rep_id",
round_val = 0.5,
sum_stats = c("perc_5", "perc_95"))
# Pixel stats = Shannon and Simpson Diversity Indices
patch_stats_4 <-
stats_by_group(img_list = img_list,
metadata = metadata,
idvar = "photo_no",
style = "C",
grouping_var = "rep_id",
round_val = 0.5,
sum_stats = c("SHDI", "SIDI"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.