Learn R Programming

crunch (version 1.28.1)

filter: Get and set slide analyses

Description

Slides are composed of analyses, which are effectively CrunchCubes with some additional metadata. You can get and set a slide's Analysis Catalog with the analyses method, and access an individual analysis with analysis. There are also helpers to get and set the components of the analysis such as filter(), weight(), transforms(), displaySettings() and vizSpecs(). You can also get the CrunchCube from an analysis using cube().

Usage

filter(x, ...)

filter(x) <- value

# S4 method for CrunchDeck,ANY weight(x) <- value

# S4 method for CrunchDeck,ANY filter(x) <- value

# S4 method for CrunchSlide transforms(x)

# S4 method for AnalysisCatalog transforms(x)

# S4 method for Analysis transforms(x)

# S4 method for CrunchSlide,ANY transforms(x) <- value

# S4 method for AnalysisCatalog,ANY transforms(x) <- value

# S4 method for Analysis,ANY transforms(x) <- value

analyses(x)

analysis(x)

analysis(x) <- value

query(x) <- value

cube(x)

cubes(x)

displaySettings(x)

displaySettings(x) <- value

vizSpecs(x)

vizSpecs(x) <- value

# S4 method for CrunchSlide analyses(x)

# S4 method for CrunchSlide analysis(x)

# S4 method for CrunchSlide,formula analysis(x) <- value

# S4 method for CrunchSlide,Analysis analysis(x) <- value

# S4 method for CrunchSlide,list analysis(x) <- value

# S4 method for CrunchSlide filter(x, ...)

# S4 method for CrunchSlide,ANY filter(x) <- value

# S4 method for CrunchSlide,ANY query(x) <- value

# S4 method for CrunchSlide cubes(x)

# S4 method for CrunchSlide cube(x)

# S4 method for CrunchSlide displaySettings(x)

# S4 method for CrunchSlide,ANY displaySettings(x) <- value

# S4 method for CrunchSlide vizSpecs(x)

# S4 method for CrunchSlide,ANY vizSpecs(x) <- value

# S4 method for AnalysisCatalog cubes(x)

# S4 method for AnalysisCatalog displaySettings(x)

# S4 method for AnalysisCatalog,list displaySettings(x) <- value

# S4 method for AnalysisCatalog vizSpecs(x)

# S4 method for AnalysisCatalog,list vizSpecs(x) <- value

# S4 method for Analysis,formula query(x) <- value

formulaToSlideQuery(query, dataset)

# S4 method for Analysis cube(x)

# S4 method for Analysis displaySettings(x)

# S4 method for Analysis,ANY displaySettings(x) <- value

# S4 method for Analysis vizSpecs(x)

# S4 method for Analysis,ANY vizSpecs(x) <- value

# S4 method for Analysis filter(x, ...)

# S4 method for ANY filter(x, ...)

# S4 method for CrunchSlide,ANY filter(x) <- value

# S4 method for Analysis,CrunchLogicalExpr filter(x) <- value

# S4 method for Analysis,CrunchFilter filter(x) <- value

# S4 method for Analysis,`NULL` filter(x) <- value

slideQueryEnv(weight, filter)

# S4 method for CrunchDeck cubes(x)

# S4 method for CrunchSlide weight(x)

# S4 method for CrunchSlide,ANY weight(x) <- value

# S4 method for Analysis weight(x)

Arguments

x

a CrunchSlide, AnalysisCatalog, or Analysis

...

ignored

value

for the setter, an object to set it

query

For formulaToSlideQuery(), a formula that specifies the query, as in newSlide(). See Details of crtabs() for more information.

dataset

For formulaToSlideQuery(), a CrunchDataset that the variables in query refer to.

weight

For slideQueryEnv() a crunch variable to use as a weight or NULL to indicate no weight should be used.

filter

for slideQueryEnv(), a CrunchFilter or CrunchExpression to filter the slide.

Details

For more complex objects like displaySettings(), vizSpecs() and transforms(), the API documentation provides more details.

Advanced users of the API can assign a list to analysis<- to specify settings on the analyses that are not otherwise available in rcrunch. The helpers formulaToSlideQuery() and slideQueryEnv() help you create objects for the query and query_environment.

Examples

Run this code
# NOT RUN {
# Examples of setting analysis details (in general these setters work on
# the slide, analysis catalog and analysis, but for brevity the examples only
# show on the slide)

# Change the filter
filter(slide) <- NULL # to remove a filter
filter(slide) <- filters(ds)[["My filter"]]
filter(deck) <- filters(ds)[["My filter"]] # Can set the same filter on a whole deck too

# Change the weight
weight(slide) <- NULL # to remove
weight(slide) <- ds$weight
weight(deck) <- ds$weight # Can set the same weight on a whole deck too

# Change the transforms
transforms(slide) <- list(rows_dimension = makeDimTransform(hide = "Neutral"))

# Change the displaySettings
displaySettings(slide) <- list(vizType = "groupedBarPlot")

# Change the vizSpecs
# viz_specs can get quite long, see
# https://crunch.io/api/reference/#post-/datasets/-dataset_id-/decks/-deck_id-/slides/
vizSpecs(slide) <- viz_specs

# Change the query
#' query(slide) <- ~ cyl + wt
# }

Run the code above in your browser using DataLab