Learn R Programming

MplusAutomation (version 0.2-5)

evaluateConditional:

Usage

evaluateConditional(tag, toProcess)

Arguments

tag
toProcess

Value

    Examples

    Run this code
    ##---- Should be DIRECTLY executable !! ----
    ##-- ==>  Define data, use random,
    ##--	or do  help(data=index)  for the standard data sets.
    
    ## The function is currently defined as
    function (tag, toProcess) 
    {
        regexp <- "(\w+)\s*([!><=]+)\s*(\d+)"
        conditional <- unlist(strapply(tag, regexp, c))
        if (length(conditional) < 3) {
            stop("Error in conditional tag: does not contain variable, operator, and value. Tag = ", 
                tag)
        }
        if (conditional[2] == "=") 
            conditional[2] = "=="
        iteratorPosition <- grep(paste("\b", conditional[1], "\b", 
            sep = ""), toProcess$iterators, perl = T)
        return(eval(parse(text = paste("toProcess$curItPos[iteratorPosition]", 
            conditional[2], conditional[3], sep = ""))))
      }

    Run the code above in your browser using DataLab