select_instances {rolap} | R Documentation |
Select instances of a flat table by value
Description
Select only the indicated instances from the flat table.
Usage
select_instances(ft, not, attributes, values)
## S3 method for class 'flat_table'
select_instances(ft, not = FALSE, attributes = NULL, values)
Arguments
ft |
A |
not |
A boolean. |
attributes |
A vector of names. |
values |
A list of value vectors. |
Details
Several values can be indicated for attributes (performs an OR operation) or several attributes and a value for each one (performs an AND operation).
If the parameter not
is true, the reported values are those that are not
included.
Value
A flat_table
object.
See Also
Other flat table transformation functions:
add_custom_column()
,
remove_instances_without_measures()
,
replace_empty_values()
,
replace_string()
,
replace_unknown_values()
,
select_attributes()
,
select_instances_by_comparison()
,
select_measures()
,
separate_measures()
,
transform_attribute_format()
,
transform_from_values()
,
transform_to_attribute()
,
transform_to_measure()
,
transform_to_values()
Examples
ft <- flat_table('iris', iris) |>
select_instances(attributes = c('Species'),
values = c('versicolor', 'virginica'))
ft <- flat_table('ft_num', ft_num) |>
select_instances(
not = TRUE,
attributes = c('Year', 'WEEK'),
values = list(c('1962', '2'), c('1964', '2'))
)