EVOLUTION-MANAGER
Edit File: convert_to_date.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: Convert many date and datetime formats as may be received...</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 convert_to_date {janitor}"><tr><td>convert_to_date {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Convert many date and datetime formats as may be received from Microsoft Excel</h2> <h3>Description</h3> <p>Convert many date and datetime formats as may be received from Microsoft Excel </p> <h3>Usage</h3> <pre> convert_to_date( x, ..., character_fun = lubridate::ymd, string_conversion_failure = c("error", "warning") ) convert_to_datetime( x, ..., tz = "UTC", character_fun = lubridate::ymd_hms, string_conversion_failure = c("error", "warning") ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>The object to convert</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Passed to further methods. Eventually may be passed to 'excel_numeric_to_date()', 'base::as.POXIXct()', or 'base::as.Date()'.</p> </td></tr> <tr valign="top"><td><code>character_fun</code></td> <td> <p>A function to convert non-numeric-looking, non-NA values in 'x' to POSIXct objects.</p> </td></tr> <tr valign="top"><td><code>string_conversion_failure</code></td> <td> <p>If a character value fails to parse into the desired class and instead returns 'NA', should the function return the result with a warning or throw an error?</p> </td></tr> <tr valign="top"><td><code>tz</code></td> <td> <p>The timezone for POSIXct output, unless an object is POSIXt already. Ignored for Date output.</p> </td></tr> </table> <h3>Details</h3> <p>Character conversion checks if it matches something that looks like a Microsoft Excel numeric date, converts those to numeric, and then runs convert_to_datetime_helper() on those numbers. Then, character to Date or POSIXct conversion occurs via 'character_fun(x, ...)' or 'character_fun(x, tz=tz, ...)', respectively. </p> <h3>Value</h3> <p>POSIXct objects for 'convert_to_datetime()' or Date objects for 'convert_to_date()'. </p> <h3>Functions</h3> <ul> <li> <p><code>convert_to_datetime</code>: Convert to a date-time (POSIXct) </p> </li></ul> <h3>See Also</h3> <p>Other Date-time cleaning: <code><a href="excel_numeric_to_date.html">excel_numeric_to_date</a>()</code> </p> <h3>Examples</h3> <pre> convert_to_date("2009-07-06") convert_to_date(40000) convert_to_date("40000.1") # Mixed date source data can be provided. convert_to_date(c("2020-02-29", "40000.1")) convert_to_datetime( c("2009-07-06", "40000.1", "40000", NA), character_fun=lubridate::ymd_h, truncated=1, tz="UTC" ) </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>