Rock
Rock

Reputation: 1

Error in gzfile(file, "wb") and cannot open compressed file R code Error

I use the CensusMapper database for work. I have been using the database for around four/five months. However, recently, once I started to extract data by R code, I am facing the error code below.

I am trying in different ways to solve the error by creating a new local path in my computer and creating a new API. However, the error code pops up over and over in R Console.

Can you please help me as your time permits?

CensusMapper database Link: https://censusmapper.ca/api/CA21#7/49.250/-123.113

Code Use:

install.packages("cancensus")
library(cancensus)
options(cancensus.api_key='Your API Key')
options(cancensus.cache_path = normalizePath("C:/cancensus"))
census_data <- get_census(dataset='CA21', regions=list(PR="59"), vectors=c("v_CA21_907"), labels="detailed", geo_format=NA, level='DA')

Error Getting:

Querying CensusMapper API...
Error in gzfile(file, "wb") : cannot open the connection                                                                                                                   
In addition: Warning message:
In gzfile(file, "wb") :
  cannot open compressed file '<local cache path>/CM_data_6e29d013137ba8f96ed1c98d7d3f63e5.rda', probable reason 'Invalid argument'

Upvotes: 0

Views: 48

Answers (0)

Related Questions