Complete {svIDE}R Documentation

Get a completion list for a R code fragment

Description

A list with matching items is returned in a string.

Usage

Complete(code, givetype = FALSE, fieldsep = "|")

Arguments

code A fraction of R code needing completion
givetype Do we append the type of each entry to the list?
fieldsep The separator to use between the item and its type

Details

The completion list is context-dependent, and it calculated as if the code was entered at the command line.

If the code ends with $ or [[, then the function look for items in a list or data.frame whose name is the last idfentifier.

If the code ends with @, then the function look for slots of the corresponding S4 object.

If the code ends with a partial identifier name, the function returns all visible matching keywords.

In all other situations, the function returns a list of the objects in .GlobalEnv.

Value

A string with the completion list

Author(s)

Philippe Grosjean <phgrosjean@sciviews.org>

See Also

guiComplete

Examples

    ## a data.frame
    data(iris)
        cat(Complete("item <- iris$"), "\n")
        cat(Complete("item <- iris[[", TRUE), "\n")
        
        ## An S4 object
    setClass("track", representation(x = "numeric", y = "numeric"))
    t1 <- new("track", x=1:20, y=(1:20)^2)
    cat(Complete("item2 <- t1@", TRUE), "\n")
    
    ## A partial identifier
    cat(Complete("item3 <- va", TRUE), "\n")
    
    ## Otherwise, a list with the content of .GlobalEnv
    cat(Complete("item4 <- "), "\n")

[Package svIDE version 0.8-2 Index]