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 © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010