Learn R Programming

trackr (version 0.10.7)

makeFeatureSet: Construct an ObjFeatureSet.

Description

The generic function for transforming an R object into the appropriate subclass of FeatureSet. This includes most introspection-based metadata extraction from the object. Metadata extraction can be customized at the package/R sesion level for specific classes of objects by defining methods for this generic.

Usage

makeFeatureSet(object, ...)

# S4 method for ggplot makeFeatureSet(object, ...)

# S4 method for trellis makeFeatureSet(object, ...)

# S4 method for gTree makeFeatureSet(object, ...)

# S4 method for recordedplot makeFeatureSet(object, ...)

# S4 method for expression makeFeatureSet(object, ...)

# S4 method for call makeFeatureSet(object, ...)

# S4 method for FeatureSet makeFeatureSet(object, ...)

# S4 method for ANY makeFeatureSet(object, ...)

# S4 method for data.frame makeFeatureSet(object, ...)

Arguments

object

The plot to summarize via metadata in an ObjFeatureSet (or subclass)

...

Other named arguments that become slots in the new PlotFeatureSet.

Value

PlotFeatureSet S4 object containing a ObjFeatureSet object and extracted plot features

Functions

  • makeFeatureSet,ggplot-method: Construct a ObjFeatureSet from an object of class ggplot.

  • makeFeatureSet,trellis-method: Construct a ObjFeatureSet from an object of class trellis.

  • makeFeatureSet,gTree-method: Construct a ObjFeatureSet from an object of class gTree.

  • makeFeatureSet,recordedplot-method: Construct a ObjFeatureSet from an object of class recordedplot.

  • makeFeatureSet,expression-method: Construct a ObjFeatureSet from an unevaluated expression.

  • makeFeatureSet,call-method: Construct a ObjFeatureSet from a call.

  • makeFeatureSet,FeatureSet-method: No-op if we already have a ObjFeatureSet

  • makeFeatureSet,ANY-method: Catch-all for attempted construction of a ObjFeatureSet from an object not of class ggplot or trellis.

  • makeFeatureSet,data.frame-method: Construct a DFFeatureSet from a data.frame

Examples

Run this code
# NOT RUN {
library(ggplot2)
mt = datasets::mtcars
pg <- ggplot(mt, aes(wt, mpg)) + geom_point()
pfs <- makeFeatureSet(pg)

library(lattice)
titan <- datasets::Titanic
pl <- barchart(Class ~ Freq | Sex + Age, data = as.data.frame(titan),
               groups = Survived, stack = TRUE, layout = c(4, 1),
               auto.key = list(title = "Survived", columns = 2))
pfs <- makeFeatureSet(pl)

dffs <- makeFeatureSet(as.data.frame(titan))

# }
# NOT RUN {
plot(1:10, 1:10)
pb <- recordPlot()
pfs <- makeFeatureSet(pb)
# }

Run the code above in your browser using DataLab