Learn R Programming

HelpersMG (version 6.2)

addS3Class: Add a S3 class to an object.

Description

Add a S3 class as first class to an object.

Usage

addS3Class(x, class = NULL)

Value

The same object with the new class as first class

Arguments

x

The object to add class.

class

The class to add.

Author

Marc Girondot marc.girondot@gmail.com

Details

addS3Class add a S3 class to an object

Examples

Run this code
print.CF <- function(x) {cat("print.CF ", x)}
result <- "Je suis donc je pense"
result <- addS3Class(result, class="CF")
class(result)
print(result)
result <- addS3Class(result, class=c("ECF", "OCF"))
class(result)
print(result)

Run the code above in your browser using DataLab