check {edl}R Documentation

Remove empty cues and/or outcomes.

Description

Remove empty cues and/or outcomes.

Usage

check(data, rm = TRUE)

Arguments

data

Data frame with columns Cues and Outcomes.

rm

Logical: whether or not to remove empty strings. (Default TRUE).

Details

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:

0

No empty cues and outcomes were detected in this row.

1

Empty cue(s) but not empty outcomes were detected in this row.

2

Empty outcome(s) but not empty cues were detected in this row.

3

Empty cue(s) AND empty outcome(s) were detected in this row.

Value

data frame or numeric vector (see details)

Author(s)

Jacolien van Rij

Examples

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),]


[Package edl version 1.0 Index]