knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of seaiceR is to simplify temporal and spatial analysis of sea ice data (for example, break-up dates for a number of years at a number of locations in a study area).
You can install the released version of seaiceR from Github with:
devtools::install_github("nxskok/seaiceR")
You need two data frames to start (eg. read in from spreadsheets):
year
(lowercase).The package includes data frames called nine_points
and nine_points_locations
which are real data from nine points. These data can be used to try out the package, and will be demonstrated here.
The basic function that does the whole analysis for a data set is called make_everything
. This has defaults, but needs input of the data frames described above plus a parameter n_cluster
which is the number of clusters for the cluster analysis. The last input n_cluster
must be specified by name (the function has a lot of optional inputs).
library(seaiceR) make_everything(nine_points, nine_points_locations, n_cluster=4)
Of course, the initial number of clusters will be a complete guess, but the output includes a scree plot and dendrograms, so make_everything
can be run a second time with an improved number of clusters.
There is a lot of output. Specifically, in order:
dendrogram
from ggdendro
, but with rect.hclust
-like rectangles to show which location is in which cluster.n_cluster
can be changed with an improved number of clusters (or to compare the output from several numbers of clusters).bounding_box
: in order, the bottom left longitude and latitude, and the top right longitude and latitude. Longitudes west (or, I guess latitudes south, but I haven't tested that) should be entered as negative numbers. This package uses Stamen maps, which come out with exactly the bounding box you ask for (unlike Google maps, which always come out square). Enthusiasts of Stamen maps may note that I chose "toner-lite" for this package. I wanted the sea to be a neutral enough background to see colours against.zoom
. This can be anything between 1 and 18; a higher value will be sharper, but entails downloading more map tiles. The default is 5.scaling
. The default is 1, so a value like 2 will make all the points bigger and a value like 0.5 will make them all smaller.If you want an individual time trend graph (eg. to copy into another document), get it like this:
time_trend_single(nine_points, loc=6)
or like this to get a linear trend:
time_trend_single(nine_points, loc=6, lowess=FALSE)
Don't be afraid to run several times until you have output that looks nice. R can take it. (There is some repetitiveness in the calculation anyway).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.