Learn R Programming

ibdreg (version 0.1.2)

sr.class: Return or set the class attribute of an object, compatible for both R and S-PLUS

Description

Return or set the class attribute of an object, compatible for both R and S-PLUS. See details.

Usage

sr.class(x)
sr.class(x) <- value

Arguments

x
Any object
value
character vector with the class(es) to assign to x

Value

  • character vector giving the S3 class(es) of x

Details

Assigns the S3 class inheritence vector for S-PLUS objects by oldClass() and R objects by class()

Examples

Run this code
# create a simple object
myobj <- "This is an object"
sr.class(myobj) <- c("temp.class", "character")

# observe the characteristics of myobj
myobj
sr.class(myobj)  # returns: "temp.class" "character"
inherits(myobj, "character") # returns TRUE

Run the code above in your browser using DataLab