-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
na for write_csv would be cool #187
Comments
Why not do: df[is.na(df)] <- ""
write_csv() IMHO this is clearer to understand at a glance and you keep data output and data mutation as distinct as possible. |
That's neat! I didn't know d <- data.frame(x = as.factor(c('foo', NA)))
d[is.na(d)] <- " "
#> Warning message:
#> In `[<-.factor`(`*tmp*`, thisvar, value = " ") :
#> invalid factor level, NA generated and it also has the side effect of type casting integer, double and logical columns to character: e <- data.frame(i = as.integer(c(1, NA)), d = c(0.5, NA), l = c(T, NA))
e[is.na(e)] <- " "
str(e)
#> 'data.frame': 2 obs. of 3 variables:
#> $ i: chr "1" " "
#> $ d: chr "0.5" " "
#> $ l: chr "TRUE" " " I'm with @ckluss on this one, I think an |
+1. |
write_csv(..., na="")
The text was updated successfully, but these errors were encountered: