Skip to contents

Load any rds/csv/csv.gz/parquet/qs file from a remote URL

Usage

load_from_url(url, ..., seasons = TRUE, nflverse = FALSE)

Arguments

url

a vector of URLs to load into memory. If more than one URL provided, will row-bind them.

...

named arguments that will be added as attributes to the data, e.g. nflverse_type = "pbp"

seasons

a numeric vector of years that will be used to filter the dataframe's season column. If TRUE (default), does not filter.

nflverse

TRUE to add nflverse_data classing and attributes.

Value

a dataframe, possibly of type nflverse_data

Examples

# \donttest{
try({ # prevents cran errors
  urls <- c("https://github.com/nflverse/nflverse-data/releases/download/rosters/roster_2020.csv",
            "https://github.com/nflverse/nflverse-data/releases/download/rosters/roster_2021.csv")
 load_from_url(urls, nflverse = TRUE, nflverse_type = "rosters for 2020 & 2021")
})
#> ── nflverse rosters for 2020 & 2021 ────────────────────────────────────────────
#>  Data updated: 2022-08-07 14:40:30 UTC
#> # A tibble: 5,379 × 30
#>    season team  position depth_chart_po…¹ jerse…² status full_…³ first…⁴ last_…⁵
#>     <int> <chr> <chr>    <chr>              <int> <chr>  <chr>   <chr>   <chr>  
#>  1   2020 ARI   DB       CB                    25 R/Inj… Johnat… Johnat… Joseph 
#>  2   2020 ARI   DB       CB                    21 Active Patric… Patrick Peters…
#>  3   2020 ARI   DB       CB                    20 PS; V… Prince… Prince  Amukam…
#>  4   2020 ARI   DB       CB                    20 Active Dre Ki… D'Andre Kirkpa…
#>  5   2020 ARI   DB       FS                    31 R/COV… Chris … Ayorun… Banjo  
#>  6   2020 ARI   DB       CB                    23 R/Inj… Robert… Robert  Alford 
#>  7   2020 ARI   DB       FS                    28 Active Charle… Charles Washin…
#>  8   2020 ARI   DB       CB                    27 Active Kevin … Kevin   Peters…
#>  9   2020 ARI   DB       SS                    32 Active Budda … Budda   Baker  
#> 10   2020 ARI   DB       CB                    33 Active Byron … Byron   Murphy 
#> # … with 5,369 more rows, 21 more variables: birth_date <date>, height <chr>,
#> #   weight <int>, college <chr>, gsis_id <chr>, espn_id <int>,
#> #   sportradar_id <chr>, yahoo_id <int>, rotowire_id <int>, pff_id <int>,
#> #   pfr_id <chr>, fantasy_data_id <int>, sleeper_id <int>, years_exp <int>,
#> #   headshot_url <chr>, ngs_position <chr>, esb_id <chr>, gsis_it_id <int>,
#> #   smart_id <chr>, entry_year <int>, rookie_year <int>, and abbreviated
#> #   variable names ¹​depth_chart_position, ²​jersey_number, ³​full_name, …
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
# }