knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of {manyfold} is to help you turns columns from your data.frame
or tibble
into a nested list which can be displayed as a tree like structure.
This package is highly experimental and only contain a few functions for now.
It is build around a single dependency: {data.tree}, and it is possible to use the full power of the functions from this excellent package on the output created by {manyfold}.
You can install this package using {remotes} (or {devtools}):
remotes::install_github("courtiol/manyfold")
library(manyfold) ## Create a toy dataset: table <- data.frame(country = c("France", "France", "France", "France", "Spain", "Spain"), region = c("Herault", "Herault", "Aude", "Paris", "Catalonia", "Andalusia"), city = c("Montpellier", "Montpellier", "Narbonne", "Paris", "Barcelona", "Sevilla")) table ## Manyfold without specifying columns (takes them all in the order they come): manyfold(table) ## Manyfold with column specification: manyfold(table, "country", "region", "city") ## The order of the columns matters: manyfold(table, "region", "city", "country") ## Another way for displaying counts: print(manyfold(table, "country", "region", "city", count = FALSE), "N") ## It works on columns containing things other than strings too: print(manyfold(mtcars), limit = 20)
If you find that this package is an idea worth pursuing, please let me know. Developing is always more fun when it becomes a collaborative work. So please also email me (or leave an issue) if you want to get involved!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.