在Ubuntu上找不到RODBC的RODBC包中的odbcConnectExcel函数 [英] odbcConnectExcel function from RODBC package for R not found on Ubuntu

查看:172
本文介绍了在Ubuntu上找不到RODBC的RODBC包中的odbcConnectExcel函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu上安装RODBC软件包有点麻烦.首先,我学会了安装以下内容:

Installing the RODBC package on Ubuntu is a bit of a kludge. First I learned to install the following:

$ sudo apt-get install r-cran-rodbc

那还不够好,因为程序包仍在寻找头文件.我通过以下方法解决了这个问题:

That wasn't good enough as the package was still looking for header files. I solved this issue by:

$ sudo apt-get install unixodbc-dev

很好,RODBC已在Ubuntu计算机上正确安装.但是,当我尝试运行以下脚本时:

Good, RODBC installed properly on the Ubuntu machine. But when I try to run the following script:

## import excel file from Dropbox

require("RODBC")

channel <- odbcConnectExcel("~/Dropbox/DATA/SAMPLE/petro.xls")

petro <- sqlFetch (channel, "weekly")

odbcClose(channel)

str(petro)
head(petro)

我收到未找到函数odbcConnectExcel的错误提示.我检查了每个字母的大小写,以确保它不是简单的错字.没有.然后,我在Windows R安装上运行了相同的脚本(当然,文件路径不同),并且脚本起作用了.

I get an error thrown that function odbcConnectExcel not found. I checked the case of each letter, making sure it was not a simple typo. Nope. Then I ran this same script on a Windows R installation (file path different, of course) and the script works.

关于为什么Ubuntu R安装找不到odbcConnectExcel函数的任何想法,以及如何使它起作用?

Any idea of why Ubuntu R installation cannot find the odbcConnectExcel function and how I can get this to work?

推荐答案

该功能在有Excel的地方可用.换句话说:不在Ubuntu上.

That functionality is available where Excel is available. In other words: not on Ubuntu.

作为参考,请参见 R数据导入/导出手册(突出显示):

For reference, from the R Data Import / Export manual (with my highlighting):

4.3.2软件包RODBC

4.3.2 Package RODBC

CRAN上的软件包RODBC提供了一个 与数据库源接口 支持ODBC接口.这是 非常广泛地使用,并允许 相同的R代码可访问不同的代码 数据库系统. RODBC运行在 Unix/Linux,Windows和Mac OS X,以及 几乎所有数据库系统都提供 支持ODBC.我们已经测试 Microsoft SQL Server,Access,MySQL, PostgreSQL,Oracle和IBM DB2 Windows和MySQL,Oracle,PostgreSQL 和Linux上的SQLite.

Package RODBC on CRAN provides an interface to database sources supporting an ODBC interface. This is very widely available, and allows the same R code to access different database systems. RODBC runs on Unix/Linux, Windows and Mac OS X, and almost all database systems provide support for ODBC. We have tested Microsoft SQL Server, Access, MySQL, PostgreSQL, Oracle and IBM DB2 on Windows and MySQL, Oracle, PostgreSQL and SQLite on Linux.

ODBC是一个客户端-服务器系统,我们 愉快地连接到DBMS 从Unix服务器上运行 Windows客户端,反之亦然.

ODBC is a client-server system, and we have happily connected to a DBMS running on a Unix server from a Windows client, and vice versa.

在Windows上,通常支持ODBC 已安装,当前版本为 可从 http://www.microsoft.com/data/odbc/作为 MDAC的一部分.在Unix/Linux上,您将 需要一个ODBC驱动程序管理器,例如 unixODBC( http://www.unixODBC.org )或 iOBDC( http://www.iODBC.org :这是 预先安装在Mac OS X中)和 为数据库安装的驱动程序 系统.

On Windows ODBC support is normally installed, and current versions are available from http://www.microsoft.com/data/odbc/ as part of MDAC. On Unix/Linux you will need an ODBC Driver Manager such as unixODBC (http://www.unixODBC.org) or iOBDC (http://www.iODBC.org: this is pre-installed in Mac OS X) and an installed driver for your database system.

Windows提供的驱动程序不仅仅适用于 DBMS以及Excel(.xls) 电子表格, DBase(.dbf)文件和 甚至是文本文件. (命名 申请不需要 已安装.哪些文件格式是 支持取决于版本 的驱动程序.)有版本 适用于Excel 2007和Access 2007(转到 http://download.microsoft.com ,以及 搜索Office ODBC,它将 导致AccessDatabaseEngine.exe), "2007 Office System驱动程序".

Windows provides drivers not just for DBMSs but also for Excel (.xls) spreadsheets, DBase (.dbf) files and even text files. (The named applications do not need to be installed. Which file formats are supported depends on the the versions of the drivers.) There are versions for Excel 2007 and Access 2007 (go to http://download.microsoft.com, and search for Office ODBC, which will lead to AccessDatabaseEngine.exe), the `2007 Office System Driver'.

这篇关于在Ubuntu上找不到RODBC的RODBC包中的odbcConnectExcel函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆