Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Objects

R provides an object oriented interface, with inheritance and objects with attributes. For an object with attributes you can access the attributes with the attr function or the @ operator:

> attr(obj, "age")
> obj@age

The get function is useful to transform a string into the name of an object:

> ds <- 1:5
> ds
> ds
[1] 1 2 3 4 5
> "ds"
[1] "ds"
> get("ds")
[1] 1 2 3 4 5
> get(ds)
Error in get(x, envir, mode, inherits) : invalid first argument



Copyright © 2004-2006 [email protected]
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.