R general failure

I was working on a markdown which was working properly. I was manipulating spatial databases and it was working perfectly. Suddenly it stopped working and I can't eve read a CSV file neither the spatial database. I tried reinstalling R studio and updating all the libraries, however nothing improved. Not even the setwd() is working I tried to change the wd and this didn't work either. Do you have any idea what Is happening?

Here is the error messages I get:

for the read csv:
Error in file(con, "rb") : cannot open the connection

for sf object:
GDAL Error 4: Unable to open
The source could be corrupt or not supported. See st_drivers() for a list of supported formats.

One day ago the code was working perfectly and the files were being used without any warning or error. Could any one help?

Thanks

If you are on macOS or a Linux-type operating system, can you post the results of the R sessionInfo() command? Also the line of code for read.csv. If you are on Windows, someone who uses that OS will need to weigh in.

Sure, Im working on MacOS

dfed <- read_sf("/Desktop/Proyectos DATA/INE/Carto/19 NUEVO LEON/DISTRITO_FEDERAL.shp")

votos <- read_csv("/Desktop/Proyectos DATA/Mapas/Abstencion/resultados_gob.csv", locale=locale(encoding="latin1"))

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] tmap_3.3-3 spdep_1.2-7 spData_2.2.1 sp_1.5-1 mapview_2.11.0
[6] ggmap_3.0.1 sf_1.0-9 lubridate_1.9.0 timechange_0.1.1 scales_1.2.1
[11] knitr_1.41 leaflet_2.1.1 e1071_1.7-12 foreign_0.8-83 readxl_1.4.1
[16] forcats_0.5.2 stringr_1.5.0 dplyr_1.0.10 purrr_1.0.0 tidyr_1.2.1
[21] tibble_3.1.8 ggplot2_3.4.0 tidyverse_1.3.2 readr_2.1.3

loaded via a namespace (and not attached):
[1] googledrive_2.0.0 leafem_0.2.0 colorspace_2.0-3 deldir_1.0-6
[5] ellipsis_0.3.2 class_7.3-20 satellite_1.0.4 base64enc_0.1-3
[9] fs_1.5.2 dichromat_2.0-0.1 rstudioapi_0.14 proxy_0.4-27
[13] bit64_4.0.5 fansi_1.0.3 xml2_1.3.3 codetools_0.2-18
[17] jsonlite_1.8.4 tmaptools_3.1-1 broom_1.0.2 dbplyr_2.2.1
[21] png_0.1-8 compiler_4.2.2 httr_1.4.4 backports_1.4.1
[25] assertthat_0.2.1 fastmap_1.1.0 gargle_1.2.1 cli_3.5.0
[29] s2_1.1.1 leaflet.providers_1.9.0 htmltools_0.5.4 tools_4.2.2
[33] gtable_0.3.1 glue_1.6.2 wk_0.7.1 Rcpp_1.0.9
[37] cellranger_1.1.0 raster_3.6-11 vctrs_0.5.1 leafsync_0.1.0
[41] crosstalk_1.2.0 lwgeom_0.2-10 xfun_0.36 rvest_1.0.3
[45] lifecycle_1.0.3 XML_3.99-0.13 googlesheets4_1.0.1 terra_1.6-47
[49] vroom_1.6.0 hms_1.1.2 parallel_4.2.2 RColorBrewer_1.1-3
[53] yaml_2.3.6 stringi_1.7.8 boot_1.3-28 RgoogleMaps_1.4.5.3
[57] rlang_1.0.6 pkgconfig_2.0.3 bitops_1.0-7 evaluate_0.19
[61] lattice_0.20-45 htmlwidgets_1.6.1 bit_4.0.5 tidyselect_1.2.0
[65] plyr_1.8.8 magrittr_2.0.3 R6_2.5.1 generics_0.1.3
[69] DBI_1.1.3 pillar_1.8.1 haven_2.5.1 withr_2.5.0
[73] units_0.8-1 stars_0.6-0 abind_1.4-5 modelr_0.1.10
[77] crayon_1.5.2 KernSmooth_2.23-20 utf8_1.2.2 tzdb_0.3.0
[81] rmarkdown_2.19 jpeg_0.1-10 grid_4.2.2 reprex_2.0.2
[85] digest_0.6.31 classInt_0.4-8 webshot_0.5.4 stats4_4.2.2
[89] munsell_0.5.0 viridisLite_0.4.1

Missing a tilde. Use


"~/Desktop/Proyectos DATA/Mapas/Abstencion/resultados_gob.csv",

or, if you are going to be running a reprex


"/Users/YOU/Desktop/Proyectos/DATA/Mapas/Abstencion/resultados_gob.csv",

and to cut down on the file hunting, put your work, including data, into an Rproject for just

“resultados_gob.csv",

Or, for a lot of data files, create a folder data and, for example

readr::read_csv(here ::here(“data/resultados_gob.csv”))

and that will work wherever you are in the project directory tree.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.