build.data.frame {vtree} | R Documentation |
Build a data frame to display with vtree
Description
Build a data frame by specifying variable names and patterns of values together with frequencies.
Usage
build.data.frame(varnames, ...)
Arguments
varnames |
A vector of variable names. |
... |
Lists of patterns and the frequency of each pattern.
When a pattern is shorter than the list of variable names
(for example, 3 variable names but only 2 values in the pattern),
|
Details
Suppose varnames=c("animal","size","hair")
,
then one pattern would be list("dog","small","short",4)
,
which specifies 4 dogs that are small and short-haired.
Another pattern could be list("cat","large","long",101)
,
specifying 101 large cats.
Value
A data frame.
Author(s)
Nick Barrowman <nbarrowman@cheo.on.ca>
Examples
# Number of countries in Africa, whether population is over 30 million or not,
# and whether landlocked or not.
# https://www.worldometers.info/geography/how-many-countries-in-africa/
#
df <- build.data.frame(
c("continent","population","landlocked"),
list("Africa","Over 30 million","landlocked",2),
list("Africa","Over 30 million","not landlocked",12),
list("Africa","Under 30 million","landlocked",14),
list("Africa","Under 30 million","not landlocked",26))
[Package vtree version 5.6.5 Index]