EVOLUTION-MANAGER
Edit File: copy_to.src_sql.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Copy a local data frame to a DBI backend.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for copy_to.src_sql {dbplyr}"><tr><td>copy_to.src_sql {dbplyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Copy a local data frame to a DBI backend.</h2> <h3>Description</h3> <p>This <code><a href="../../dplyr/html/copy_to.html">copy_to()</a></code> method works for all DBI sources. It is useful for copying small amounts of data to a database for examples, experiments, and joins. By default, it creates temporary tables which are typically only visible to the current connection to the database. </p> <h3>Usage</h3> <pre> ## S3 method for class 'src_sql' copy_to( dest, df, name = deparse(substitute(df)), overwrite = FALSE, types = NULL, temporary = TRUE, unique_indexes = NULL, indexes = NULL, analyze = TRUE, ... ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>dest</code></td> <td> <p>remote data source</p> </td></tr> <tr valign="top"><td><code>df</code></td> <td> <p>A local data frame, a <code>tbl_sql</code> from same source, or a <code>tbl_sql</code> from another source. If from another source, all data must transition through R in one pass, so it is only suitable for transferring small amounts of data.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>name for new remote table.</p> </td></tr> <tr valign="top"><td><code>overwrite</code></td> <td> <p>If <code>TRUE</code>, will overwrite an existing table with name <code>name</code>. If <code>FALSE</code>, will throw an error if <code>name</code> already exists.</p> </td></tr> <tr valign="top"><td><code>types</code></td> <td> <p>a character vector giving variable types to use for the columns. See <a href="http://www.sqlite.org/datatype3.html">http://www.sqlite.org/datatype3.html</a> for available types.</p> </td></tr> <tr valign="top"><td><code>temporary</code></td> <td> <p>if <code>TRUE</code>, will create a temporary table that is local to this connection and will be automatically deleted when the connection expires</p> </td></tr> <tr valign="top"><td><code>unique_indexes</code></td> <td> <p>a list of character vectors. Each element of the list will create a new unique index over the specified column(s). Duplicate rows will result in failure.</p> </td></tr> <tr valign="top"><td><code>indexes</code></td> <td> <p>a list of character vectors. Each element of the list will create a new index.</p> </td></tr> <tr valign="top"><td><code>analyze</code></td> <td> <p>if <code>TRUE</code> (the default), will automatically ANALYZE the new table so that the query optimiser has useful information.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>other parameters passed to methods.</p> </td></tr> </table> <h3>Value</h3> <p>A <code><a href="../../dplyr/html/tbl.html">tbl()</a></code> object (invisibly). </p> <h3>Examples</h3> <pre> library(dplyr) set.seed(1014) mtcars$model <- rownames(mtcars) mtcars2 <- src_memdb() %>% copy_to(mtcars, indexes = list("model"), overwrite = TRUE) mtcars2 %>% filter(model == "Hornet 4 Drive") cyl8 <- mtcars2 %>% filter(cyl == 8) cyl8_cached <- copy_to(src_memdb(), cyl8) # copy_to is called automatically if you set copy = TRUE # in the join functions df <- tibble(cyl = c(6, 8)) mtcars2 %>% semi_join(df, copy = TRUE) </pre> <hr /><div style="text-align: center;">[Package <em>dbplyr</em> version 1.4.4 <a href="00Index.html">Index</a>]</div> </body></html>