$sudo apt-get install r-cran-rodbc
这还不够好,因为程序包仍然在寻找头文件.我解决了这个问题:
$sudo apt-get install unixodbc-dev
好的,RODBC在Ubuntu机器上正确安装.但是当我尝试运行以下脚本时:
## 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安装上运行相同的脚本(文件路径当然不同),脚本可以工作.
知道为什么Ubuntu R安装无法找到odbcConnectExcel函数以及如何让它工作?
作为参考,从R Data Import / Export manual(我突出显示):
4.3.2 Package RODBC
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 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.On Windows ODBC support is normally
installed,and current versions are
available from
07001 as
part of MDAC. On Unix/Linux you will
need an ODBC Driver Manager such as
unixODBC (07002) or
iOBDC (07003: this is
pre-installed in Mac OS X) and an
installed driver for your database
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
07004,and
search forOffice ODBC
,which will lead to AccessDatabaseEngine.exe),the `2007 Office System Driver’.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。