Reputation: 4708
When I read in a file I couldn't work out why two similar character
variables were printing differently using tibble
- one with quotation marks and the other one without. After a bit of digging, I noticed that one contained trailing white space and the other one didn't.
Is white space the only reason why a character
variable would be printed with quotation marks? I can't see any reference to this behaviour on the tibble
site.
Example:
library(tidyverse)
df <- tibble(a = c("hjhjh", "popopo"), d = c(1, 2))
df
# # A tibble: 2 x 2
# a d
# <chr> <dbl>
# 1 hjhjh 1
# 2 popopo 2
df_with_space <- tibble(a = c("hjhjh ", "popopo"), d = c(1, 2))
df_with_space
#quotation marks:
# # A tibble: 2 x 2
# a d
# <chr> <dbl>
# 1 "hjhjh " 1
# 2 "popopo" 2
Upvotes: 3
Views: 496