check {edl} | R Documentation |
Remove empty cues and/or outcomes.
check(data, rm = TRUE)
data |
Data frame with columns |
rm |
Logical: whether or not to remove empty strings. (Default TRUE). |
When rm=FALSE
the function returns a code for each row of the data
frame indicating whether an empty cue or outcome was detected.
The function may return the following values:
No empty cues and outcomes were detected in this row.
Empty cue(s) but not empty outcomes were detected in this row.
Empty outcome(s) but not empty cues were detected in this row.
Empty cue(s) AND empty outcome(s) were detected in this row.
data frame or numeric vector (see details)
Jacolien van Rij
test1 <- c("a_b", "a__b", "_a_b", "a_b_", "_a__b_", "___")
## Not run:
# this returns an error:
check(test1)
## End(Not run)
# data frame with cues and outcomes:
(dat <- data.frame(Cues=test1, Outcomes=sample(test1), stringsAsFactors=TRUE))
# remove empty:
check(dat)
# only indicating which rows contain empty cues/outcomes:
(test <- check(dat, rm=FALSE))
# check empty cues:
dat[test %in% c(1,3),]
# check empty outcomes:
dat[test %in% c(2,3),]