You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When converting to character to numeric with imputed column types (col_types=NULL), type_convert ignores leading whitespace when parsing (regardless of whether trim_ws is TRUE or FALSE). It trims trailing whitespace after parsing if trim_ws is TRUE. The argument description says that both leading and trailing whitespace should be trimmed before parsing if trim_ws is TRUE, and implies that neither should be ignored when parsing if trim_ws is FALSE.
# This gives columns of "1" and 2, rather than 1 and 2
type_convert(data.frame(a="1 ", b=" 2"), trim_ws=TRUE)
# This gives columns "1 " and 2, rather than "1 " and " 2"
type_convert(data.frame(a="1 ", b=" 2"), trim_ws=FALSE)
The text was updated successfully, but these errors were encountered:
markpurver
changed the title
type_convert ignores leading whitespace when parsing, and also parses before trimming
type_convert ignores leading whitespace when imputing column type, and also imputes before trimming
Mar 28, 2024
When converting to character to numeric with imputed column types (col_types=NULL),
type_convert
ignores leading whitespace when parsing (regardless of whethertrim_ws
is TRUE or FALSE). It trims trailing whitespace after parsing iftrim_ws
is TRUE. The argument description says that both leading and trailing whitespace should be trimmed before parsing iftrim_ws
is TRUE, and implies that neither should be ignored when parsing iftrim_ws
is FALSE.The text was updated successfully, but these errors were encountered: