Skip to contents

Filter through a data frame of stocks using a search pattern. The pattern is split up by spaces, and each resulting pattern is matched to the values of the stock name and ticker.

Usage

search_stocks(x, pattern)

Arguments

x

The data frame of stocks (e.g. the default_stock_data).

pattern

The pattern to use to filter x.

Value

A filtered version of x

Examples

search_stocks(default_stock_data, "Al p")
#> # A tibble: 59 × 100
#>    symbol company…¹ excha…² indus…³ website descr…⁴ ceo   secur…⁵ sector prima…⁶
#>    <chr>  <chr>     <chr>   <chr>   <chr>   <chr>   <chr> <chr>   <chr>    <dbl>
#>  1 APD    Air Prod… NEW YO… "Indus… www.ai… "Air P… Seif… Air Pr… Manuf…    2813
#>  2 ALK    Alaska A… NEW YO… "Sched… www.al… "Alask… Brad… Alaska… Trans…    4512
#>  3 ALB    Albemarl… NEW YO… "Plast… www.al… "Albem… Jerr… Albema… Manuf…    2821
#>  4 ALLE   Allegion… NEW YO… "Secur… www.al… "Alleg… NA    Allegi… Admin…    7381
#>  5 LNT    Alliant … NASDAQ  "Nucle… https:… "Allia… John… Allian… Utili…    4931
#>  6 ALL    Allstate… NEW YO… "Direc… www.al… "The A… Thom… Allsta… Finan…    6331
#>  7 GOOGL  Alphabet… NASDAQ  "All O… abc.xyz "Larry… Sund… Alphab… Infor…    7375
#>  8 MO     Altria G… NEW YO… "Tobac… https:… "Altri… Will… Altria… Manuf…    2111
#>  9 AAL    American… NASDAQ  "Sched… www.aa… "Ameri… Thom… Americ… Trans…    4512
#> 10 AIG    American… NEW YO… "Third… www.ai… "Ameri… Bria… Americ… Finan…    6331
#> # … with 49 more rows, 90 more variables: employees <dbl>, address <chr>,
#> #   state <chr>, city <chr>, ZIP <chr>, country <chr>, phone <dbl>,
#> #   capital_expenditures <dbl>, cash_change <dbl>, cash_flow <dbl>,
#> #   cash_flow_financing <dbl>, changes_in_inventories <dbl>,
#> #   changes_in_receivables <dbl>, currency <chr>, depreciation <dbl>,
#> #   filing_type <chr>, fiscal_date <dbl>, net_borrowings <dbl>,
#> #   net_income <dbl>, report_date <dbl>, total_investing_cash_flows <dbl>, …