new(Class, ...)
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. |
new("numeric") # returns prototype for the class new("numeric", c(1, 51, 10)) # returns a numeric vector with specified valuesetClass("my_sequence", representation(x="numeric", y="numeric")) new("my_sequence", x = 1:5, y = sin(x))