HistWrapR | R Documentation |
A wrapper function that runs both smooth_map
and class_map
, useful for iterating the same arguments over similar maps with lapply
or mclapply
. My experience is that running multiple maps lapply
is not quicker than a for
loop running the two HistMapR functions separately, and looping makes it easier to follow progress. However, parallelisation with mclapply
has the potential to be considerably faster, hence this function
HistWrapR(ras.file, colour.table=NULL, out.format="save", out.dir=".", ...)
ras.file |
The path to the input raster to be smoothed and classified. Note that this is not the raster object itself (as with other functions in HistMapR), but the path to it, which allows for parallelisation. |
colour.table |
Dataframe containing colour thresholds for different categories. Should either be an output from |
out.format |
"save" saves the classified raster, while "return" returns it as an object. |
out.dir |
The directory where rasters should be saved. |
... |
Additional arguments passed to |
Saves or returns the classified raster.
Alistair Auffret and Adam Kimberley
Auffret, A.G., Kimberley, A., et al., 2017, HistMapR: Rapid digitization of historical maps in R, Methods in Ecology and Evolution, doi: 10.1111/2041-210X.12788., Link. GitHub repository.
Hijmans, R.J. (2023) terra: Spatial Data Analysis. R package version 1.7-29, https://CRAN.R-project.org/package=terra.
data.loc <- system.file("data", package="HistMapR")
ras.smoothed <- rast(paste0(data.loc,"/ras.smoothed.tiff"))
col.table <- read.csv(paste0(data.loc,"/col.table.csv"))
HistWrapR(ras.file=ras.loc, colour.table = col.table, out.format="return")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.