Donwload arquivo internet

Prezados, boa tarde.

Alguém pode me ajudar a baixar a planilha disponível nesse site: Global Supply Chain Pressure Index (GSCPI) - FEDERAL RESERVE BANK of NEW YORK (newyorkfed.org)

A planilha fica no link https://www.newyorkfed.org/medialibrary/research/interactives/gscpi/downloads/gscpi_data.xlsx

Mas ao tentar baixar no R, encontro o seguinte erro: Error: `` not found

O código:


# Tentativa 1

httr::GET(
  "https://www.newyorkfed.org/medialibrary/research/interactives/gscpi/downloads/gscpi_data.xlsx",
  httr::write_disk("gscpi_date.xlsx", overwrite = T)
)

# Tentativa 2

download.file(url, "gscpi_date.xlsx", mode = "wb")

gscpi <- readxl::read_excel(path = "gscpi_date.xlsx", skip = 6)

link <- "https://www.newyorkfed.org/medialibrary/research/interactives/gscpi/downloads/gscpi_data.xlsx"
download.file(link, "gscpi_date.xls")

"gscpi_date.xls" |>
  readxl::read_xls(sheet = 2) |>
  dplyr::filter(!is.na(Date)) |>
  dplyr::select(1, 2)
#> New names:
#> • `` -> `...3`
#> • `` -> `...4`
#> # A tibble: 298 × 2
#>    Date         GSCPI
#>    <chr>        <dbl>
#>  1 31-Jan-1998 -0.921
#>  2 28-Feb-1998 -0.460
#>  3 31-Mar-1998 -0.113
#>  4 30-Apr-1998 -0.148
#>  5 31-May-1998 -0.504
#>  6 30-Jun-1998 -0.797
#>  7 31-Jul-1998 -0.940
#>  8 31-Aug-1998 -0.951
#>  9 30-Sep-1998 -0.964
#> 10 31-Oct-1998 -0.818
#> # … with 288 more rows

Created on 2022-11-27 with reprex v2.0.2