filter_views: Filter spatial units

View source: R/view-manipulators.R

filter_viewsR Documentation

Filter spatial units

Description

Select, remove (or duplicate) rows from all views in a composition by their row locations or according to conditions based on a specific view.

Usage

filter_views(current.views, rows, view = "intraview", ...)

Arguments

current.views

the current view composition.

rows

row (integer) location; positive values to keep (duplicate) and/or negative to remove.

view

the name of the view to be used for filtering.

...

logical expressions defined in terms of the variables in view passed on to dplyr::filter().

Details

The values in rows have priority over the other parameters. If rows doesn't contain integer values then filtering is performed based on the view specified in view and expressions (...) returning logical values defined in terms of the variables in view.

Value

A mistyR view composition with filtered spatial units from all views.

See Also

<data-masking>.

Other view manipulation functions: rename_view(), select_markers()

Examples

# Create a view composition with an intraview and filter

library(dplyr)

# get the expression data
data("synthetic")
expr <- synthetic[[1]] %>% select(-c(row, col, type))

# compose
misty.views <- create_initial_view(expr)

# select only the first 10 spatial units and preview
misty.views %>%
  filter_views(1:10) %>%
  str()

# select only the units where the expression of ligA is larger than 0.5
# and preview
misty.views %>%
  filter_views(NA, "intraview", ligA > 0.5) %>%
  str()

saezlab/mistyR documentation built on March 25, 2024, 4:12 p.m.