Description Usage Arguments Value Author(s) See Also Examples
This function helps to illustrate the relationship between columns contained
into a dataset. For example, imagine you have 3 columns containing country
,
region
and city
in your dataset. Checking that the right cities are in
the right regions, and that the right regions are in the right countries, can
be quite tedious (especially for a large dataset) when the data are shown as
a table. It is much easier if the data are shown as a tree. This function
helps you do that.
1 |
.data |
the .data.frame or tibble to use |
... |
the columns to use to build the tree, quoted and separated by commas, starting with the broadest classifier on the left |
count |
whether or not add the number of rows in the level names (default = TRUE) |
count_sep |
which separator to use when combining counts to level names (default = ":") |
missing |
how to call NA in the tree (default = "UNKNOWN") |
an object of class Node
on which many further actions are possible
(see data.tree()
)
Alexandre Courtiol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## 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
## Without specifying columns (takes them all in the order they come):
manyfold(table)
## With column specification:
manyfold(table, "country", "region", "city")
## Another way for displaying counts:
tree <- manyfold(table, "country", "region", "city", count = FALSE)
print(tree, "N")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.