View source: R/build.data.frame.R
build.data.frame | R Documentation |
Build a data frame by specifying variable names and patterns of values together with frequencies.
build.data.frame(varnames, ...)
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),
|
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.
A data frame.
Nick Barrowman <nbarrowman@cheo.on.ca>
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.