Learn R Programming

esmprep (version 0.2.0)

rmInvalid: rmInvalid

Description

removeInvalid removes the invalid ESM questionnaires as specified by the user.

Usage

rmInvalid(dfList, RELEVANTVN_ES = NULL)

Arguments

dfList

a list. Each element of the list must be a data.frame. Each data.frame is a separate raw ESM dataset/an ESM questionnaire version. If there is just one ESM version the list therefore contains one data.frame.

RELEVANTVN_ES

a list. This list is generated by function setES and it is extended once either by function genDateTime or by function splitDateTime.

Value

The user receives a list containing 4 elements:

  1. dfValid, i.e. the raw ESM dataset(s), after removing all invalid lines of data.

  2. listInvalid, i.e. the raw ESM dataset(s), containing only the removed lines of data.

  3. rmInvalidFinished, i.e. a logical value, specifying whether at least one line of data was removed due to being invalid.

  4. noLinesRemovedAtAll, i.e. a logical vector, specifying in which of the ESM raw dataset(s) there were invalid lines of data.

See Details for more information.

Details

A data line is assumed to be invalid if both the start date and the start time are missing (NA = not available).

See Also

Exemplary code (fully executable) in the documentation of esmprep (function 9 of 29).

Examples

Run this code
# NOT RUN {
# o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
# Prerequisites in order to execute rmInvalid. Start ----------------
# Use example list delivered with the package
RELEVANTVN_ES <- RELEVANTVN_ESext
# keyLsNew is a list of datasets, also delivered with the package
# Prerequisites in order to execute rmInvalid. End ------------------
# ------------------------------------------------------
# Run function 9 of 29; see esmprep functions' hierarchy.
# ------------------------------------------------------
# keyLsNew is the result of function 'genDateTime' (or of function 'splitDateTime').
rmInvLs <- rmInvalid(keyLsNew, RELEVANTVN_ES)
# Result of function 'rmInvalid' is a list with 4 elements:
names(rmInvLs)
# o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
# }

Run the code above in your browser using DataLab