firstclass-set: Add a class in first place

firstclass<-R Documentation

Add a class in first place

Description

Add a new class name to the classes of an R object, and make it the first in the list of classes the objects belongs to.

Usage

firstclass(x) <- value

Arguments

x

the object the new class is assigned to. Needs to be an object that can be copied.

value

character string with the new class name.

Value

The same object x, now belonging (additionally) to the class given as "value".

Author(s)

Ute Hahn, ute@imf.au.dk

Examples

x <- data.frame(u = 1:2, t = 3:4)
class(x)
firstclass(x) <- "my.first.class"
class(x)
firstclass(x) <- "data.frame"

plutils documentation built on Feb. 19, 2026, 3:01 a.m.