array2df: Converts an array into a data.frame for plotting with...

Description Usage Arguments Details

View source: R/array2df.R

Description

Converts an array into a data.frame for plotting with ggplotHelper

Usage

1
array2df(array.in, x.yearmon = T)

Arguments

array.in

array with data for plotting. If the array contains multiple series, these must be ordered column-wise.

Details

Returns a dataframe with a "names" column and a "data" column. If the array.in contains multiple columns, these are labeled by a legend in the new data frame corresponding to the column name. Test: array1 <- array(c(1:30), dim = c(10,3), dimnames = list(paste0("Date", 1:10), paste0("Var", 1:3))) ggplotHelper::line_chart(array2df(array1), x = "names", y = "data", group = "legend", legend.names = colnames(array1), legend.position = "top")


pgarnry/ggplotHelper documentation built on May 25, 2019, 2:54 a.m.