rOpenSpain / CatastRo

R package to query Sede Electrónica del Catastro (Spain)

Home Page:http://ropenspain.github.io/CatastRo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: $ operator is invalid for atomic vectors

calejero opened this issue · comments

I tried to run this code:

options(repos = c(
  ropenspain = "https://ropenspain.r-universe.dev",
  CRAN = "https://cloud.r-project.org"
))
install.packages("CatastRo")

library(CatastRo)
catr_ovc_get_cpmrc(rc = '13077A01800039')

Console result:

> catr_ovc_get_cpmrc(rc = '13077A01800039')
Error: $ operator is invalid for atomic vectors

NOTE
I have analyzed code and I think problem is here:

valid_srs <- valid_srs[valid_srs$ovc_service == TRUE, "SRS"]
valid <- as.character(valid_srs$SRS)

valid_srs is a vector object, not a data.frame. So, when you try to convert valid_srs$SRS into character vector you obtain a error.

UPDATE

Error is solved when I run directly library(tibble)

I have validated that tibble is included to be imported inside Imports into Description file.

Thanks for the report. Is this still happening? Please also note that CatastRo is already on CRAN:

https://cran.r-project.org/web/packages/CatastRo/index.html

Could you please recheck after installing the CRAN version?:

install.packages("CatastRo")

library(CatastRo)
catr_ovc_get_cpmrc(rc = '13077A01800039')

Also, note that valid_srs should be a tibble, as it comes from catastro::catr_srs_values, that is a tibble as well:

https://github.com/rOpenSpain/CatastRo/blob/6b7e892f1ff90c19ce4c866a0decfe6961c84554/data-raw/catr_srs_values.R#L7:L25

valid_srs <- CatastRo::catr_srs_values

I would have a look, thanks

I added a fix for this, could you please recheck the code with the dev version?:

options(repos = c(
  ropenspain = "https://ropenspain.r-universe.dev",
  CRAN = "https://cloud.r-project.org"
))
install.packages("CatastRo")

library(CatastRo)
catr_ovc_get_cpmrc(rc = '13077A01800039')

Many thanks