Select Items from a Word Pool in Given Ranges
pickList.Rd
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.
Arguments
- data
- ranges
A data.frame of two rows, and with column names corresponding to a subset of the column names in
data
. The two rows give the minimum and maximum values, respectively, of variables indata
. Alternatively, you can supply a named list containing the minimum and maximum values for one or more variables indata
.- nitems
Number of items per list
- nlists
Number of lists
- replace
A logical value, indicating whether the sampling of items (rows) of
data
is to allow sampling with replacement.
Value
A data frame of the same shape as data
containing the selected items prefixed by
the list
number.
Details
sample
will generate an error if fewer than nitems * nlists
items are
within the specified ranges
and replace=FALSE
.
References
A related word list generator: Friendly, M. Word list generator. http://datavis.ca/online/paivio/
Examples
data(Paivio)
# 2 lists, no selection on any variables
pickList(Paivio, nlists=2)
#> list itmno word imagery concreteness meaningfulness frequency syl
#> 523 1 523 letter 6.37 6.94 5.96 100 2
#> 261 1 261 doll 6.17 6.94 6.12 46 1
#> 695 1 695 procession 5.70 5.90 5.63 27 3
#> 200 1 200 corn 6.47 6.90 6.96 50 1
#> 231 1 231 deed 3.63 4.19 5.32 50 1
#> 875 1 875 underworld 4.37 4.43 5.76 5 3
#> 102 1 102 boredom 3.83 1.94 4.63 1 2
#> 234 1 234 deluge 4.57 4.38 5.32 2 2
#> 656 1 656 perjury 3.37 2.70 5.92 1 3
#> 90 1 90 blacksmith 6.17 6.83 7.44 19 2
#> 836 2 836 temerity 2.33 2.19 2.04 1 4
#> 164 2 164 citation 3.57 4.42 5.06 1 3
#> 541 2 541 macaroni 6.47 7.00 6.00 2 4
#> 747 2 747 saloon 6.43 6.70 7.12 12 2
#> 91 2 91 blandness 2.83 2.03 3.84 0 2
#> 518 2 518 legislation 3.33 4.00 5.92 23 4
#> 441 2 441 hurricane 6.33 6.52 7.04 7 3
#> 787 2 787 slush 6.27 6.65 6.80 1 1
#> 423 2 423 history 3.47 3.03 6.91 100 3
#> 84 2 84 belongings 5.10 5.85 5.38 6 3
#> letters freerecall
#> 523 6 0.625
#> 261 4 0.625
#> 695 10 0.344
#> 200 4 0.594
#> 231 4 0.313
#> 875 10 0.500
#> 102 7 0.594
#> 234 6 0.313
#> 656 7 0.531
#> 90 10 0.344
#> 836 8 0.344
#> 164 8 0.281
#> 541 8 0.406
#> 747 6 0.406
#> 91 9 0.344
#> 518 11 0.281
#> 441 9 0.219
#> 787 5 0.469
#> 423 7 0.438
#> 84 10 0.219
# 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),])
#> imagery concreteness meaningfulness
#> 1 1.63 1.18 1.92
#> 3 5.17 5.72 5.92
(high <- as.data.frame(apply(Paivio[,vars], 2, fivenum))[c(3,5),])
#> imagery concreteness meaningfulness
#> 3 5.17 5.72 5.92
#> 5 6.90 7.70 9.22
# 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)])
#> imagery concreteness meaningfulness frequency syl
#> 4.2680 3.6085 5.4395 17.6000 2.8500
colMeans(highI[,c(4:8)])
#> imagery concreteness meaningfulness frequency syl
#> 6.0630 6.1220 6.4545 46.3000 1.7500
# using a list of ranges
L <- list(imagery=c(1,5), concreteness=c(1,4))
pickList(Paivio, L)
#> list itmno word imagery concreteness meaningfulness frequency syl
#> 359 1 359 functionary 1.77 2.62 4.29 1 4
#> 214 1 214 crime 4.43 3.81 6.84 50 1
#> 267 1 267 drama 4.90 3.66 7.00 23 2
#> 764 1 764 session 3.67 3.62 5.40 19 2
#> 59 1 59 attitude 2.77 1.83 5.60 50 3
#> 535 1 535 loquacity 3.40 3.11 3.92 0 4
#> 841 1 841 theory 2.57 1.90 5.88 50 2
#> 771 1 771 shock 4.67 3.97 6.20 50 1
#> 442 1 442 hypothesis 2.40 2.25 5.36 4 4
#> 880 1 880 upkeep 3.07 2.50 4.76 2 2
#> letters freerecall
#> 359 11 0.125
#> 214 5 0.406
#> 267 5 0.188
#> 764 7 0.406
#> 59 8 0.188
#> 535 9 0.375
#> 841 6 0.250
#> 771 5 0.406
#> 442 10 0.406
#> 880 6 0.281