knitr::opts_chunk$set(echo = TRUE, warning=FALSE)
suppressWarnings(suppressMessages(suppressPackageStartupMessages(library(rAnaLab))))

This function was developed from an example from www.milanor.net. We load a png image of a color pallette called rocks-in-the-river from (www.color-hex.com)[http://www.color-hex.com/color-palette/61776]. We first load a pallette image from our system data and then call the function. The function returns an image with swatches with the hex values and a list of the hex values.

library(rAnaLab)
fi <- system.file("extdata", "rocks-in-the-river.png", package = "rAnaLab")
res <- kmeans_pallette(fi)
res

The values from the site are:

rocks_int_the_river <- c('#4e5166','#7c90a0','#b5aa9d','#b9b7a7','#747274')

So we obtained the expected answer.



jrminter/rAnaLab documentation built on July 20, 2020, 4:09 a.m.