admin管理员组文章数量:1122846
I'm a student of Data Science, and I'm working in a project to visualize a database of Spanish reservoirs; but I'm getting this error:
# package installations if required:
if(!require("tidyverse")) install.packages("tidyverse")
if(!require("janitor")) install.packages("janitor")
if(!require("patchwork")) install.packages("patchwork")
if(!require("RODBC")) install.packages("RODBC")
# load the packages
library(tidyverse)
library(readxl)
library(janitor)
library(patchwork)
library(RODBC)
# URL of the database
url <- ".zip"
# download
tempf <- tempfile() # temp file
download.file(url, tempf)
unzip(tempf)
# open the connection with mdb
conn <- odbcConnectAccess2007("BD-Embalses.mdb")
I installed everything on my system (Arch linux), but I can't make the connection to the database for some reason (it says that the function could not be found). Everything is in Spanish, I'm just translating it into English.
I'm a student of Data Science, and I'm working in a project to visualize a database of Spanish reservoirs; but I'm getting this error:
# package installations if required:
if(!require("tidyverse")) install.packages("tidyverse")
if(!require("janitor")) install.packages("janitor")
if(!require("patchwork")) install.packages("patchwork")
if(!require("RODBC")) install.packages("RODBC")
# load the packages
library(tidyverse)
library(readxl)
library(janitor)
library(patchwork)
library(RODBC)
# URL of the database
url <- "https://www.miteco.gob.es/content/dam/miteco/es/agua/temas/evaluacion-de-los-recursos-hidricos/boletin-hidrologico/Historico-de-embalses/BD-Embalses.zip"
# download
tempf <- tempfile() # temp file
download.file(url, tempf)
unzip(tempf)
# open the connection with mdb
conn <- odbcConnectAccess2007("BD-Embalses.mdb")
I installed everything on my system (Arch linux), but I can't make the connection to the database for some reason (it says that the function could not be found). Everything is in Spanish, I'm just translating it into English.
Share Improve this question asked Nov 22, 2024 at 14:33 AlbertoAlberto 255 bronze badges1 Answer
Reset to default 2As can be found in the win.R file of the RODBC package, odbcConnectAccess2007
is a Windows-exclusive function. It depends on an ODBC driver for MS Access being available, and these are only available for Windows.
This means you need to find an alternative way, e.g. using mdbtools with the ODBC driver and either DBI + odbc (recommended) or RODBC, mdbtools + Hmisc::mdb.get
, or RJDBC + UCanAccess.
Side note, always download.file(url, tempf, mode = "wb")
if you're downloading a non-text file. This would lead to errors further down the line.
本文标签:
版权声明:本文标题:database - Error in odbcConnectAccess2007("BD-Embalses.mdb"). R could not find the function "odbcConn 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303136a1931778.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论