Similar to R Wrong encoding in Rstudio console (but ok in R GUI and ggplot2)
I have the same problem with greek characters
I am running under Windows 10 and the version of Rstudio is 1.0.143
In RStudio, Tools --> Global Options --> Code --> Saving --> "Default text encoding" is set to UTF-8
This, This and this didn;t help
Also, The RStudio support on encoding didn;t help. Maybe something I am missing
I used
Sys.setlocale(category = "LC_ALL", locale = "Greek")
but that only solves the plotting and viewing of the df
Lets do an Example
#Create a dataframe
x<-c("Κόκκινο", "Κίτρινο","Πράσινο")
y<-c(5,4,9)
df<-data.frame(x,y)
names(df)<-c("colour","frequency")
When summarising with dplyr
> df%>%count(colour)
# A tibble: 3 x 2
colour n
<fctr> <int>
1 Êßôñéíï 1
2 Êüêêéíï 1
3 ÐñÜóéíï 1
When viewing the dataframe its all fine
>View(df)
ggplot encodes just fine
ggplot(df,aes(colour,frequency))+geom_point()
Is there a way we can solve this?
My session info
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Greek_Greece.1253 LC_CTYPE=Greek_Greece.1253
LC_MONETARY=Greek_Greece.1253
[4] LC_NUMERIC=C LC_TIME=Greek_Greece.1253
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2 janitor_0.3.0 scales_0.5.0 readxl_1.0.0
dplyr_0.7.3 purrr_0.2.3 readr_1.1.1
[8] tidyr_0.7.1 tibble_1.3.4 ggplot2_2.2.1 tidyverse_1.1.1