CreateColorsByVar: CreateColorsByVar

Description Usage Arguments Details Value

Description

Creates dataframe of a variable and the associated colors

Usage

1
CreateColorsByVar(df, by, b_pal, r_pal_num, pal, output, display)

Arguments

df

dataframe that contains the variable column

by

column name of variable used to create colors. Creates a palette based on the unique number of factors in the variable and assigned colors based on the 'pal', 'b_pal', or 'r_pal' parameters.

pal

name of color palette funtions (e.g., rainbow, heat.colors, terrain.colors, topo.colors, or cm.colors) used to create colors. This parameter has priority over the other color palette parameters. Default is NULL.

r_pal

Specifc number of 'R_pal' color palette from the PlotKML Package (e.g., 1 = R_pal[[1]]). This parameter has priority over the 'b_pal' parameter for setting the colors. Default is NULL.

b_pal

color palette name from 'RColorBrewer' package, default is "Set1". Automatically adjusts number of colors to match the unique number of factors in the 'by' parameter.

output

logical, whether or not to output colors

plot

logical, whether or not display a color pie plot

Details

Used in other functions. Color palette can either be a typical palette (e.g. rainbow, heat.heat.colors, terrain,colors, ) using the 'pal' parameter or a RColorBrewer palette using the 'r_pal' parameter, or a RColorBrewer palette using the "b_pal" parameter (e.g. "Accent"). The number of colors is always automatically adjusted to match the unique number of factors in the "by" parameter column of the df.

Value

df with "by" names and a unique hexidecimal colors for each


Blakemassey/gisr documentation built on Aug. 30, 2020, 12:14 a.m.