Learn R Programming

bcdata (version 0.5.1)

select.bcdc_promise: Select columns from bcdc_query_geodata() call

Description

Similar to a dplyr::select call, this allows you to select which columns you want the Web Feature Service to return. A key difference between dplyr::select and bcdata::select is the presence of "sticky" columns that are returned regardless of what columns are selected. If any of these "sticky" columns are selected only "sticky" columns are return. bcdc_describe_feature is one way to tell if columns are sticky in advance of issuing the Web Feature Service call.

See dplyr::select for details.

Usage

# S3 method for bcdc_promise
select(.data, ...)

Arguments

.data

object of class bcdc_promise (likely passed from bcdc_query_geodata())

...

One or more unquoted expressions separated by commas. See details.

Methods (by class)

  • select(bcdc_promise): select.bcdc_promise

Examples

Run this code
# \donttest{
try(
  feature_spec <- bcdc_describe_feature("bc-airports")
)

try(
  ## Columns that can selected:
  feature_spec[feature_spec$sticky == TRUE,]
)

## Select columns
try(
  res <- bcdc_query_geodata("bc-airports") %>%
    select(DESCRIPTION, PHYSICAL_ADDRESS)
)

## Select "sticky" columns
try(
  res <- bcdc_query_geodata("bc-airports") %>%
    select(LOCALITY)
)
# }


Run the code above in your browser using DataLab