pickList | R Documentation |
This is a convenience function to provide the capability to select items from a given word pool, with restrictions on the range of any numeric variables.
pickList(data, ranges, nitems = 10, nlists = 1, replace = FALSE)
data |
A data.frame, typically a word list like |
ranges |
A data.frame of two rows, and with column names corresponding to a subset of the column names
in |
nitems |
Number of items per list |
nlists |
Number of lists |
replace |
A logical value, indicating whether the sampling of items (rows) of |
sample
will generate an error if fewer than nitems * nlists
items are
within the specified ranges
and replace=FALSE
.
A data frame of the same shape as data
containing the selected items prefixed by
the list
number.
Michael Friendly
A related word list generator: Friendly, M. Word list generator. http://datavis.ca/online/paivio/
sample
data(Paivio)
# 2 lists, no selection on any variables
pickList(Paivio, nlists=2)
# Define ranges for low and high on imagery, concreteness, meaningfulness
# These go from low - median, and median-high on each variable
vars <- 3:5
(low <- as.data.frame(apply(Paivio[,vars], 2, fivenum))[c(1,3),])
(high <- as.data.frame(apply(Paivio[,vars], 2, fivenum))[c(3,5),])
# select two lists of 10 low/high imagery items
lowI <- pickList(Paivio, low[,"imagery", drop=FALSE], nitems=10, nl=2)
highI <- pickList(Paivio, high[,"imagery", drop=FALSE], nitems=10, nl=2)
# compare means
colMeans(lowI[,c(4:8)])
colMeans(highI[,c(4:8)])
# using a list of ranges
L <- list(imagery=c(1,5), concreteness=c(1,4))
pickList(Paivio, L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.