Save a sequence of still images to disk with a single function call and data frame.
save_seq(data, style = "map", use_mclapply = FALSE, mc.cores = 1L, ...)
data | a data frame containing networks, tiles, lines or polygons information. |
---|---|
style | character, must be |
use_mclapply |
|
mc.cores | integer, the number of CPU cores requested for parallel processing, passed to |
... | additional arguments passed to |
usually returns NULL after writing files to disk. May optionally return a list of ggplot objects with or without the file writing side effect.
save_seq
is a convenient wrapper function for save_map
and save_ts
. It provides some moderate generality and abstraction
by moving the most proximal aspects of data preparation inside the function, i.e., breaking a data frame into a list of data frame subsets by plot ID
and passing each explicitly to iterative calls to either save_map
or save_ts
.
The option for parallel processing on Linux systems (by forking with parallel::mclapply
) is also part of save_seq
.
Using mclapply
was chosen for convenience and may be changed in a future package version.
It does not save much in the way of gross typing, but calling a single wrapper function, passing mostly the same arguments,
and not having to explicitly call save_map
or save_ts
withing the context of map
or walk
calls is arguably
cleaner, simpler, and less complex for some use cases.
The additional arguments ...
passed to save_map
or save_ts
are required, not optional.
Any call to save_seq
will consist mostly of these arguments.
It is best to first make sure you can successfully call save_map
and save_ts
directly. Then try this wrapper function.
See the intoductory vignette for details: browseVignettes(package="mapmate")
.
# NOT RUN { library(dplyr) library(purrr) data(annualtemps) temps <- mutate(annualtemps, frameID = Year - min(Year) + 1) %>% group_by(Year, frameID) %>% summarise(z=mean(z)) xlm <- range(temps$Year) ylm <- range(temps$z) # should specify a dir or set working dir for file output # consider running over a smaller subset of frame IDs save_seq(temps, style="tsline", x="Year", y="z", id="frameID", col="blue", xlm=xlm, ylm=ylm) # }