Skip to contents

This function subsets the biodiversity data based on user search criteria for species by their vernacular name and scientific name. The function handles two search modes determined by the radio button selection.

Usage

selected_bd_data(
  data = load_bd_data(),
  radio_btn_search_by_name,
  radio_btn_search_by_name_id,
  search_by_ver_or_sci_name,
  selected_by_ver_or_sci_name
)

Arguments

data

A data frame. The biodiversity dataset to filter.

radio_btn_search_by_name

Character. The current value of the search mode radio button.

radio_btn_search_by_name_id

Character. The ID value that indicates search by vernacular name mode.

search_by_ver_or_sci_name

Character. The primary search term entered by the user.

selected_by_ver_or_sci_name

Character. The secondary selection made by the user.

Value

A data frame containing the filtered biodiversity data that matches both the vernacular name and scientific name criteria.

Details

The function behaves differently based on the search mode:

  • If radio_btn_search_by_name equals radio_btn_search_by_name_id, it filters by vernacular name first (search_by_ver_or_sci_name) and then by scientific name (selected_by_ver_or_sci_name).

  • Otherwise, it filters by scientific name first (search_by_ver_or_sci_name) and then by vernacular name (selected_by_ver_or_sci_name).