找回密码
 注册
查看: 614|回复: 0

R语言 RMySQL包 RMySQL-package()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 19:23:22 | 显示全部楼层 |阅读模式
RMySQL-package(RMySQL)
RMySQL-package()所属R语言包:RMySQL

                                         R interface to the MySQL database
                                         R接口的MySQL数据库

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The functions in this package allow you interact with one or more MySQL databases from R.
在此套件的功能,让您互动与一个或多个MySQL数据库R.


概观----------Overview----------

A typical usage of the R-MySQL interface is:
R-MySQL接口的典型用法是:

Connect and authenticate to one or more MySQL databases:
连接并验证一个或多个MySQL数据库:

List tables and fields in a table:
目录表和表中的字段:

Import and export data.frames:
进出口data.frames:

Run an arbitrary SQL statement and extract all its output (returns a data.frame):
执行任意SQL语句,并提取它的所有输出(返回一个数据框):

Run an SQL statement and extract its output in pieces (returns a result set):
执行一个SQL语句,并提取其输出件(返回一个结果集):

Run multiple SQL statements and process the various result sets  (note the client.flag value in the dbConnect call):
运行多个SQL语句并处理不同的结果集(注意client.flag值dbConnect呼叫):

Get meta-information on a connection (thread-id, etc.):
获取一个连接上的元信息(线程id等):

Close connections:
关闭连接:


MySQL和R的数据之间的映射----------Data mappings between MySQL and R----------

MySQL tables are read into R as data.frames, but without coercing character or logical data into factors.  Similarly while exporting  data.frames, factors are exported as character vectors.
MySQL的表是只读到R为data.frames,但没有强迫因素的字符或逻辑数据。同样的因素而出口data.frames,导出为特征向量。

Integer columns are usually imported as R integer vectors, except for cases such as BIGINT or UNSIGNED INTEGER which are coerced to R's double precision vectors to avoid  truncation (currently R's integers are signed 32-bit quantities).
通常为R的整数向量,进口除了如BIGINT或UNSIGNED INTEGERR的double的精度向量被强制为避免截断(R的符号的32位整数的情况下,整列数量)。

Time variables are imported/exported as character data, so you need  to convert these to your favorite date/time representation.
时间变量的导入/导出为字符数据,所以你需要将它们转换您最喜爱的日期/时间表示。

Currently there are no facilities to import/export BLOBs.
目前没有任何设施,导入/导出BLOBs。


RDBMS的表,data.frames,和数据类型----------RDBMS tables, data.frames, and data types----------

Tables in a relational database are only superficially similar  to R's data.frames (e.g., tables as unordered sets of rows compared to data.frames as ordered sets, tables having referential constraints,  indexes, and so on.)  
在关系数据库中的表R的data.frames只是表面上的相似(例如,表相比data.frames无序的行集的有序集合,表具有参照约束,索引等。)


用户身份验证----------User authentication----------

Although you can specify user authentication parameters  (user, password, database, and host) in the call to dbConnect, the preferred method to pass  these parameters to the server is through a MySQL  default.file, e.g., "\$HOME/.my.cnf" (or "c:/my.cnf"  under Windows). The MySQL dbConnect method parses the  default.file=\$HOME/.my.cnf to initialize connections to MySQL databases. This file consists of zero or more named sections each starting with a line of the form [section-name]; each section includes zero or more MySQL variable declaration per line,  such as, user=, password=, host=, etc. For instance,
虽然你可以指定用户的认证参数(用户名,密码,数据库和主机)在调用dbConnect,把这些参数传递到服务器的首选方法是通过一个MySQL default.file,如 ,“\$HOME/.my.cnf(或c:/my.cnf在Windows下)。 “MySQL的dbConnect方法解析初始化连接到MySQL数据库default.file=\$HOME/.my.cnf。此文件包含零个或多个命名的节,每行的形式开始[section-name],每个部分包含零个或多个MySQL的变量声明每行,如,user=,password=的host=,等。例如,


参考文献----------References----------

for more details on the R/S-Plus database interface.
http://www.mysql.com for details.

(作者)----------Author(s)----------


David A. James <dj@bell-labs.com>
Saikat DebRoy <saikat@stat.wisc.edu>




参见----------See Also----------

On database managers:
在数据库管理器:

dbDriver dbUnloadDriver
dbDriverdbUnloadDriver

On connections, SQL statements and resultSets:
在连接,SQL语句和ResultSets:

dbConnect dbDisconnect dbSendQuery dbGetQuery fetch dbClearResult
dbConnectdbDisconnectdbSendQuerydbGetQueryfetchdbClearResult

On transaction management:
事务管理:

dbCommit dbRollback
dbCommitdbRollback

On meta-data:
在元数据:

summary dbGetInfo dbGetDBIVersion dbListTables dbListConnections dbListResults dbColumnInfo dbGetException dbGetStatement dbHasCompleted dbGetRowCount
summarydbGetInfodbGetDBIVersiondbListTablesdbListConnectionsdbListResultsdbColumnInfodbGetExceptiondbGetStatementdbHasCompleted dbGetRowCount


实例----------Examples----------


# create a MySQL instance and create one connection.[创建一个MySQL实例,并创建一个连接。]
> m <- dbDriver("MySQL")  ## or MySQL()[#或MySQL()]
<MySQLDriver4378)>

# open the connection using user, passsword, etc., as[打开的连接使用用户,passsword,等,作为]
# specified in the "[iptraffic]" section of the [“iptraffic]”一节中指定]
# configuration file \file{\$HOME/.my.cnf}[配置文件\文件{\ $ HOME / .my.cnf}]
> con <- dbConnect(m, group = "iptraffic")
> rs <- dbSendQuery(con, "select * from HTTP_ACCESS where IP_ADDRESS = '127.0.0.1'")
> df <- fetch(rs, n = 50)
> dbHasCompleted(rs)
[1] FALSE
> df2 <- fetch(rs, n = -1)
> dbHasCompleted(rs)
[1] TRUE
> dbClearResult(rs)
> dim(dbGetQuery(con, "show tables"))
[1] 74   1
> dbListTables(con)   

## End(Not run)[#(不执行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-24 14:55 , Processed in 0.020645 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表