filter_rows: Conditionally filter rows from a (spatial) data frame

View source: R/fct_filter_rows.R

filter_rowsR Documentation

Conditionally filter rows from a (spatial) data frame

Description

Designed to be used within Shiny applications. Allows a user to specify conditions (using R or dplyr syntax) to filter rows from a data frame or spatial (sf) data frame. This function uses dplyr's filter to conditionally subset rows.

Usage

filter_rows(filter_df, filter_conditions)

Arguments

filter_df

data frame or spatial (sf) data frame to apply condition and filter rows from.

filter_conditions

a single element character vector specifying conditions used to subset rows from filter_df. Conditions should be specified in R or dplyr syntax (e.g. column_1 == "xyz" will filter all rows from filter_df where column_1 has a value of "xyz").

Value

a data frame or spatial (sf) data frame containing the records filtered from filter_df.

Example filter conditions

The following are example operations that can used to test conditions to filter rows from a data frame:

* ==, >, >=,

* &, |, !,

* is.na()

See filter for more information and examples on filtering rows from a data frame.


livelihoods-and-landscapes/maplandscape documentation built on March 20, 2023, 5:43 a.m.