new
Generate a New Object

Description

Returns a new object of a specified class. If no other arguments are given, the object is a copy of the prototype from the class definition. Most classes have a generator function with the same name as the class that is likely to be more useful in most situations.

Usage

new(Class, ...)

Arguments

Class the name of the class from which to create an object, or a classRepresentation object defining the class.
... named or unnamed arguments. Use named arguments to supply values for slots with the corresponding names. Use unnamed arguments to provide data to be coerced to the specified class. If the new class extends another class, an object from the extended class can be supplied, along with optional named arguments for any additional slots.
Value
returns a new object of the specified class.
See Also
setClass, getClass
Examples
new("numeric") # returns prototype for the class
new("numeric", c(1, 51, 10)) # returns a numeric vector with specified value

setClass("my_sequence", representation(x="numeric", y="numeric")) new("my_sequence", x = 1:5, y = sin(x))

Package methods version 6.0.0-69
Package Index