EVOLUTION-MANAGER
Edit File: read_xpt.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: Read and write SAS transport files</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 read_xpt {haven}"><tr><td>read_xpt {haven}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Read and write SAS transport files</h2> <h3>Description</h3> <p>The SAS transport format is a open format, as is required for submission of the data to the FDA. </p> <h3>Usage</h3> <pre> read_xpt( file, col_select = NULL, skip = 0, n_max = Inf, .name_repair = "unique" ) write_xpt(data, path, version = 8, name = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>file</code></td> <td> <p>Either a path to a file, a connection, or literal data (either a single string or a raw vector). </p> <p>Files ending in <code>.gz</code>, <code>.bz2</code>, <code>.xz</code>, or <code>.zip</code> will be automatically uncompressed. Files starting with <code>http://</code>, <code>https://</code>, <code>ftp://</code>, or <code>ftps://</code> will be automatically downloaded. Remote gz files can also be automatically downloaded and decompressed. </p> <p>Literal data is most useful for examples and tests. It must contain at least one new line to be recognised as data (instead of a path) or be a vector of greater than length 1. </p> <p>Using a value of <code><a href="../../readr/html/clipboard.html">clipboard()</a></code> will read from the system clipboard.</p> </td></tr> <tr valign="top"><td><code>col_select</code></td> <td> <p>One or more selection expressions, like in <code><a href="../../dplyr/html/select.html">dplyr::select()</a></code>. Use <code>c()</code> or <code>list()</code> to use more than one expression. See <code>?dplyr::select</code> for details on available selection options. Only the specified columns will be read from <code>data_file</code>.</p> </td></tr> <tr valign="top"><td><code>skip</code></td> <td> <p>Number of lines to skip before reading data.</p> </td></tr> <tr valign="top"><td><code>n_max</code></td> <td> <p>Maximum number of lines to read.</p> </td></tr> <tr valign="top"><td><code>.name_repair</code></td> <td> <p>Treatment of problematic column names: </p> <ul> <li> <p><code>"minimal"</code>: No name repair or checks, beyond basic existence, </p> </li> <li> <p><code>"unique"</code>: Make sure names are unique and not empty, </p> </li> <li> <p><code>"check_unique"</code>: (default value), no name repair, but check they are <code>unique</code>, </p> </li> <li> <p><code>"universal"</code>: Make the names <code>unique</code> and syntactic </p> </li> <li><p> a function: apply custom name repair (e.g., <code>.name_repair = make.names</code> for names in the style of base R). </p> </li> <li><p> A purrr-style anonymous function, see <code><a href="../../rlang/html/as_function.html">rlang::as_function()</a></code> </p> </li></ul> <p>This argument is passed on as <code>repair</code> to <code><a href="../../vctrs/html/vec_as_names.html">vctrs::vec_as_names()</a></code>. See there for more details on these terms and the strategies used to enforce them.</p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>Data frame to write.</p> </td></tr> <tr valign="top"><td><code>path</code></td> <td> <p>Path to a file where the data will be written.</p> </td></tr> <tr valign="top"><td><code>version</code></td> <td> <p>Version of transport file specification to use: either 5 or 8.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>Member name to record in file. Defaults to file name sans extension. Must be <= 8 characters for version 5, and <= 32 characters for version 8.</p> </td></tr> </table> <h3>Value</h3> <p>A tibble, data frame variant with nice defaults. </p> <p>Variable labels are stored in the "label" attribute of each variable. It is not printed on the console, but the RStudio viewer will show it. </p> <p><code>write_xpt()</code> returns the input <code>data</code> invisibly. </p> <h3>Examples</h3> <pre> tmp <- tempfile(fileext = ".xpt") write_xpt(mtcars, tmp) read_xpt(tmp) </pre> <hr /><div style="text-align: center;">[Package <em>haven</em> version 2.3.1 <a href="00Index.html">Index</a>]</div> </body></html>