knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

manyfold

Lifecycle: experimental CRAN status

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}.

Installation

You can install this package using {remotes} (or {devtools}):

remotes::install_github("courtiol/manyfold")

Example

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)

Help \& feedbacks wanted!

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!



courtiol/manyfold documentation built on March 7, 2020, 1:59 a.m.