Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facet_grid problem : input string 1 is invalid in this locale?

Tags:

r

ggplot2

I am trying to create facet grid with the following code

p <- ggplot(melted,aes(factor(country))) + geom_bar() +opts(axis.text.x =   theme_text(angle = 90,hjust = 1)) 

p + facet_grid(. ~ provider)

but I always get the following error:

Error in sub("^[^:]+: ([^\n]+)\n[0-9]+:(.*)$", "\1\2", expr) : input string 1 is invalid in this locale

I do not have any idea what I am doing wrong. also tried to factor my facet, which doesn't work either.

Thx in advance!

like image 416
Matt Bannert Avatar asked Aug 23 '10 13:08

Matt Bannert


1 Answers

I fixed this one on my own. Here's the solution. My locale was set to 1 "de_DE.UTF-8/de_DE.UTF-8/C/C/de_DE.UTF-8/de_DE.UTF-8"

which I checked with

Sys.getlocale()

According to the bioconductor mailinglist, locale should be set to C. This is what I did

Sys.setlocale(locale="C")

Et voilà the faceting worked just like it used to. I have no clue how the locale changed, but that's how you can change it whenever this problem occurs.

HTH someone else too.

like image 119
Matt Bannert Avatar answered Oct 18 '22 19:10

Matt Bannert