r - picker() from manipulate package with accented characteres -
i'm using picker()
function manipulate ggplot2 line graph. have strings accented characters in list given picker. when select string accented characters, ggplot()
returns
error in plot.window(xlim, ylim, log = log, ...).
the sample code works fine:
manipulate( barplot(as.matrix(longley[,factor]), beside = true, main = factor), factor = picker("gnp", "unemployed", "employed"))
however, if adapt code follows, picker()
fails:
library(manipulate) dflongley <- longley colnames(dflongley)[7] <- "employé" encoding(colnames(dflongley)) <- "utf-8" x <- c("gnp", "unemployed", "employé") encoding(x) <- "utf-8" manipulate( barplot(as.matrix(dflongley[,factor]), beside = true, main = factor), factor = picker(as.list(x)))
head(dflongley, 1)
gives this:
gnp.deflator gnp unemployed armed.forces population year employ<u+00e9> 1947 83 234.289 235.6 159 107.608 1947 60.323
x:
[1] "gnp" "unemployed" "employ<u+00e9>"
when "employé" selected, null passed picker()
barplot()
, following errors:
error in plot.window(xlim, ylim, log = log, ...) : need finite 'xlim' values in addition: warning messages: 1: in min(w.l) : no non-missing arguments min; returning inf 2: in max(w.r) : no non-missing arguments max; returning -inf 3: in min(x) : no non-missing arguments min; returning inf 4: in max(x) : no non-missing arguments max; returning -inf
any idea of wrong?
the problem solved looking @ this question, , adjusting system preferences command: system("defaults write org.r-project.r force.lang en_us.utf-8")
Comments
Post a Comment