library(kohonen.hexagons) library(kohonen) library(pander)
optDEF <- knitr::opts_chunk$get() knitr::opts_chunk$set(comment = "#>", fig.align = 'center') op <- par(mar=c(1,1,1,1))
hexagonMap
and hexagonPT
Plot single hexagon.
plot.new() hexagonPT(.5,.5, r = .3)
Plot a map of hexagons.
data <- class::somgrid(8,6,"hexagonal")$pts head(data) x <- data[,"x"] y <- data[,"y"] hexagonMap(x, y) # Add color hexagonMap(x, y, col = "yellow") # Add colors and text hexagonMap(x, y, col = c("tomato1","skyblue","orange"), border = c("red", "black")) text(x,y,1:length(x), cex = .6) title("Hexagonal cells \n with cell ID number")
hexagonPT_verticles
hexagonPT_verticles(1,1)
A (top)
B (left upper)
C (left lower)
D (bottom)
E (right)
F (right upper).
verticles <- hexagonPT_verticles(1,1) %>% t plot(verticles, type = "n", main = "Names of polygon verticles") # initialize a plot polygon(verticles, border = "grey") text(verticles,labels = LETTERS[1:6], col = "blue")
hex_neighbourhood_line_pos
hex_neighbourhood_line_pos(x, y) %>% head
hex_neighbour_dist
library(kohonen) data("Spectra2", package = "spHelper") som_model <- som(Spectra2$spc, grid = somgrid(7,7,"hexagonal")) hex_neighbour_dist(som_model) %>% head
hexagon_default_params
hexagon_default_params() %>% pander hexagon_default_params(r = 1) %>% pander hexagon_default_params(l = 1) %>% pander data <- class::somgrid(8,6,"hexagonal")$pts hexagon_default_params(x = data[,"x"], y = data[,"y"]) %>% pander hexagon_default_params(x = data[,"x"], y = data[,"y"]*2) %>% pander hexagon_default_params(x = data[,"x"]*2, y = data[,"y"]) %>% pander
Do not read further. Vignette is not completed yet.
Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The html_vignette
output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The html_vignette
format:
Note the various macros within the vignette
section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the title
field and the \VignetteIndexEntry
to match the title of your vignette.
The html_vignette
template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
output: rmarkdown::html_vignette: css: mystyles.css
The figure sizes have been customised so that you can easily put two images side-by-side.
plot(1:10) plot(10:1)
You can enable figure captions by fig_caption: yes
in YAML:
output: rmarkdown::html_vignette: fig_caption: yes
Then you can use the chunk option fig.cap = "Your figure caption."
in knitr.
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using knitr::kable()
.
knitr::kable(head(mtcars, 10))
Also a quote using >
:
"He who gives up [code] safety for [code] speed deserves neither." (via)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.