dfToTree: Converts a data.frame to a data.tree format

View source: R/data.tree-conversion.R

dfToTreeR Documentation

Converts a data.frame to a data.tree format

Description

Converts a data.frame to a data.tree format

Usage

dfToTree(df, hierarchy = colnames(df))

Arguments

df

data.frame

hierarchy

ordered character vector of column names defining the hierarchy

Details

**Disclaimer**

These are helper functions from the github version of the shinyTree package which are very helpful to transform dataframes to nested lists and back again. These functions are not yet available (still listed as an enhancement Add data.frame -> shinyTree helper function #8 ) in the lastest version on CRAN v0.2.7 and the github version builds are currently failing. Rather than pulling the dev version of the pacakge to include these functions, adding them here until a stable version is available on CRAN. I claim no credit or ownership of any of this code. All credit should be attributed to the original authors listed on the github repo.

Value

nested list

Author(s)

Jasper Schelfhout jasper.schelfhout@openanalytics.eu

Examples

## Not run: 
df <- data.frame(Titanic)
tree <- dfToTree(df, c("Sex", "Class", "Survived"))

## End(Not run)

cusom/CUSOM.ShinyHelpers documentation built on Oct. 23, 2023, 6:50 a.m.