es4dataframe: es4dataframe constructor

View source: R/es4dataframe.R

es4dataframeR Documentation

es4dataframe constructor

Description

this would be the typical way to instantiate an es4dataframe, an S4 wrapper for data.frame.

Usage

es4dataframe(..., stringsAsFactors = FALSE)

Arguments

...

all that good regular data.frame stuff

stringsAsFactors

boolean defaults to FALSE because why would you do anything else?

Details

a well behaving S4 data.frame wrapper. i hope what you expect to happen happens. my main concern was that subsetting functions should return an S4 class instead of a data.frame.

i've implemented methods for as.data.frame, $, [, [<, and merge. these methods are just simple wrappers for the S3 methods.

note that merge will have to be implemented in any class that extends es4dataframe and has slots so that these functions know how to merge those slots.

with the defaults and those definitions many methods work without fuss and return the S4 object including subset, na.omit, unique, $<-.

other methods you don't expect to return the S4 class anyway work fine like: duplicated, as.list, [[, etc.

i think it makes sense to let some methods default to returning the underlying data.frame only and not the S4 class. for example, edit. in the applications i have in mind, i don't really want the user to be able to edit the S4 classes data 'by hand'. and if you want that functionality you can always extend the class and add it.

i haven't implemented cbind or rbind because i can't figure out how to do it. they'd also have to be implemented in any class that extends es4dataframe with slots.

Value

an S4 class of es4dataframe.

See Also

es4dataframe-class

as.data.frame-es4dataframe-method

Examples

testdf <- es4dataframe(a = rnorm(10), b = rnorm(10))

williamcioffi/sattagutils documentation built on June 3, 2022, 10:21 a.m.