File: dbReadTable.Rd

package info (click to toggle)
rmysql 0.10.16-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 416 kB
  • sloc: ansic: 1,662; sh: 58; makefile: 5
file content (63 lines) | stat: -rw-r--r-- 2,265 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/table.R
\docType{methods}
\name{dbReadTable,MySQLConnection,character-method}
\alias{dbExistsTable,MySQLConnection,character-method}
\alias{dbListFields,MySQLConnection,character-method}
\alias{dbListTables,MySQLConnection-method}
\alias{dbReadTable,MySQLConnection,character-method}
\alias{dbRemoveTable,MySQLConnection,character-method}
\title{Convenience functions for importing/exporting DBMS tables}
\usage{
\S4method{dbReadTable}{MySQLConnection,character}(conn, name, row.names,
  check.names = TRUE, ...)

\S4method{dbListTables}{MySQLConnection}(conn, ...)

\S4method{dbExistsTable}{MySQLConnection,character}(conn, name, ...)

\S4method{dbRemoveTable}{MySQLConnection,character}(conn, name, ...)

\S4method{dbListFields}{MySQLConnection,character}(conn, name, ...)
}
\arguments{
\item{conn}{a \code{\linkS4class{MySQLConnection}} object, produced by
\code{\link[DBI]{dbConnect}}}

\item{name}{a character string specifying a table name.}

\item{row.names}{A string or an index specifying the column in the DBMS table
to use as \code{row.names} in the output data.frame. Defaults to using the
\code{row_names} column if present. Set to \code{NULL} to never use
row names.}

\item{check.names}{If \code{TRUE}, the default, column names will be
converted to valid R identifiers.}

\item{...}{Unused, needed for compatiblity with generic.}
}
\value{
A data.frame in the case of \code{dbReadTable}; otherwise a logical
indicating whether the operation was successful.
}
\description{
These functions mimic their R/S-Plus counterpart \code{get}, \code{assign},
\code{exists}, \code{remove}, and \code{objects}, except that they generate
code that gets remotely executed in a database engine.
}
\note{
Note that the data.frame returned by \code{dbReadTable} only has
primitive data, e.g., it does not coerce character data to factors.
}
\examples{
if (mysqlHasDefault()) {
con <- dbConnect(RMySQL::MySQL(), dbname = "test")

# By default, row names are written in a column to row_names, and
# automatically read back into the row.names()
dbWriteTable(con, "mtcars", mtcars[1:5, ], overwrite = TRUE)
dbReadTable(con, "mtcars")
dbReadTable(con, "mtcars", row.names = NULL)
}
}