Dear all, I have imported a dataset from Stata using the foreign package. The original data contain French characters such as è and ç . After importing, string variables containing names of French departments have changed. E.g. Ardèche became Ard\x8fche. I would like to ask how I could plot these changed strings, since now the strings with special characters fail to be printed in the plot (either using plot() or ggplot2()).
I have googled for solutions, but actually find it hard to determine whether I should change my R setup or should read in the data in a different way. Since I work on a mac I changed my local according to the R for Mac OS X FAQ, chapter 9. Below is some info on my setup and code and output on what works for me and what does not. Thank you in advance for you comments. Best, Richard #-------------- rm(list=ls()) sessionInfo() # R version 2.15.2 (2012-10-26) # Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) # # locale: # [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 # creating variables department <- c("Nord","Paris","Ard\x8fche") department2 <- c("Nord", "Paris", "Ardèche") n <- c(2,4,1) # creating dataframes df <- data.frame(department,n) df2 <- data.frame(department2,n) department # [1] "Nord" "Paris" "Ard\x8fche" department2 # [1] "Nord" "Paris" "Ardèche" plot(df) # fails to show the text "Ardèche" plot(df2) # shows text "Ardèche" # EOF [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.