ObjectStructure.S3: Class: ObjectStructure.S3

Description Usage Arguments Value Fields Intended use of this class Author(s) References See Also Examples

View source: R/ObjectStructure.S3.r

Description

Class to represent object structures (S3).

Usage

1

Arguments

.x

ANY. An object of an arbitrary class whose class attribute should be updated so that it becomes an instance of class ObjectStructure.S3. Mainly intended for rapid prototyping purposes

struc

Constructor argument. See field .struc.

Value

Instance of class ObjectStructure.S3.

Fields

.struc

data.frame. Object structure.

Intended use of this class

This S3 class, or to be more precise its constructor function, exists mainly for rapid prototyping purposes. This is mainly reflected in the fact, that when specifying .x, this constructor function will simply update the class attribute of whatever object has been provided.

However, it also allows for a more formal OOP-style of rapid prototyping by offering explicit class fields (all arguments except .x). Nevertheless, it is probably advisable to switch to an explicit formal approach such as S4 and/or Reference Classes once the package or application has reached a certain state of maturity.

Author(s)

Janko Thyson [email protected]

References

http://github.com/rappster/listr

See Also

getStructure, getRawStructure, RawObjectStructure.S3

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

## Informal use (intended mainly for rapid prototyping) //
## Takes *any* object and simply changes the class attributes
ObjectStructure.S3(data.frame())  
ObjectStructure.S3("example of other input")  

## Formal use (explicitly using field constructor arguments) //
ObjectStructure.S3()
ObjectStructure.S3(struc = getStructure(list(a = 1, b = 2), extended = FALSE))

## Recommended: inlcude namespace //
listr::ObjectStructure.S3(
  struc = getStructure(list(a = 1, b = 2), extended = FALSE)
)


## End(Not run)

rappster/listr documentation built on May 24, 2017, 7:32 p.m.