-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
arrange()-ing words with accented vowels #1280
Comments
Can you please make the example reproducible? i.e. something that I can copy and paste directly into R. (And no need to include sessionInfo()` |
library("dplyr")
words <- c("casa", "árbol", "zona", "órgano")
df1 <- data.frame(words)
df1 %>% arrange(words)
df2 <- data_frame(words)
df2 %>% arrange(words) |
I believe this is by design. library("dplyr")
words <- c("casa", "árbol", "zona", "órgano")
df1 <- data.frame(words, stringsAsFactors = FALSE)
df1 %>% arrange(words)
# words
# 1 casa
# 2 zona
# 3 árbol
# 4 órgano
df2 <- data_frame(words)
df2 %>% arrange(words)
# words
# 1 casa
# 2 zona
# 3 árbol
# 4 órgano |
Yes, this is just yet another victim of |
Weird. So, apparently I'll need to coerce
|
That's where it gets interesting. The library("dplyr")
words <- c("casa", "árbol", "zona", "órgano")
df1 <- data.frame(words, stringsAsFactors = FALSE)
df1[order(df1$words), ]
# [1] "árbol" "casa" "órgano" "zona"
df1 %>% arrange(words)
# words
# 1 casa
# 2 zona
# 3 árbol
# 4 órgano
df2 <- data_frame(words)
df2[order(df2$words), ]
# Source: local data frame [4 x 1]
#
# words
# 1 árbol
# 2 casa
# 3 órgano
# 4 zona
arrange(df2, words)
# Source: local data frame [4 x 1]
#
# words
# 1 casa
# 2 zona
# 3 árbol
# 4 órgano It turns out that the reason most likely has to do with the R locale vs. the C locale. The following is from the
I know we can use |
arrange() interacts differently with data_frame than with data.frame when ordering words with accented vowels:
The text was updated successfully, but these errors were encountered: