[R-br] set locale no Linux

Manoel Galdino mcz.fea em gmail.com
Segunda Setembro 15 15:38:40 BRT 2014


É, tinha achado esse link depois que mandei o e-mail pra lista.
Rodei (no Linux): sudo locale-gen pt_BR.UTF-8

E recebi a msg que deu certo.
Rodando no R

> locales <- system("locale -a", intern = TRUE)> library(stringr)> unique(str_split_fixed(locales, "\\.", 2)[, 1]) [1] "C"     "POSIX" "en_AG" "en_AU" "en_BW" "en_CA" "en_DK" "en_GB" "en_HK" "en_IE" "en_IN" "en_NG" "en_NZ" "en_PH" "en_SG" "en_US" "en_ZA" "en_ZM" "en_ZW"
[20] "pt_BR"


Tudo parece estar certo. Mas tentei:

> Sys.setlocale("LC_TIME", "pt_BR")[1] ""Warning message:In Sys.setlocale("LC_TIME", "pt_BR") :
  OS reports request to set locale to "pt_BR" cannot be honored


Não funfou. Alguma ideia?

Obrigado,
Manoel

2014-09-15 15:24 GMT-03:00 Rodolfo Silva <zhushazang em gmail.com>:

> Você precisa configurar o locale no seu sistema:
>
> https://help.ubuntu.com/community/Locale
>
> Att
>
> On 09/15/2014 03:24 PM, Manoel Galdino wrote:
> > Apenas corrigindo, tenho o Ubuntu 12.10.
> >
> > Grato,
> > Manoel
> >
> > On Mon, Sep 15, 2014 at 3:20 PM, Manoel Galdino <mcz.fea em gmail.com
> > <mailto:mcz.fea em gmail.com>> wrote:
> >
> >     Olá,
> >
> >     Eu tentei mudar o local do R (time) pra Brasil, mas não consegui.
> >     Alguém consegue me ajudar? Segue abaixo o que tentei fazer e o
> >     máximo de info possível para o resultado ser reproduzível.
> >
> >     Eu tentei:
> >
> >     Sys.setlocale("LC_TIME", "Portuguese_Brazil.UTF-8")
> >     [1] ""
> >     Warning message:
> >     In Sys.setlocale("LC_TIME", "Portuguese_Brazil.UTF-8") :
> >       OS reports request to set locale to "Portuguese_Brazil.UTF-8"
> cannot be honored
> >
> >
> >     Tentei outras variantes de Brasil (como "br", "BR", mas não
> >     funcionou). Aí, procurando no StackOverflow, descobri como recuperar
> >     os localles possíveis (no linux, pelo que entendi):
> >
> >     locales <- system("locale -a", intern = TRUE)
> >     > library(stringr)
> >     > unique(str_split_fixed(locales, "\\.", 2)[, 1])
> >      [1] "C"     "POSIX" "en_AG" "en_AU" "en_BW" "en_CA" "en_DK" "en_GB"
> "en_HK" "en_IE" "en_IN" "en_NG" "en_NZ" "en_PH" "en_SG" "en_US" "en_ZA"
> "en_ZM" "en_ZW"
> >
> >
> >     Como se vê pela lista acima, não parece haver opção de pt ou br.
> >     Alguma ideia de como resolver isso?
> >
> >     Session info do R:
> >
> >     > sessionInfo()
> >     R version 3.0.2 (2013-09-25)
> >     Platform: x86_64-pc-linux-gnu (64-bit)
> >
> >     locale:
> >      [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C
> LC_COLLATE=C         LC_MONETARY=C        LC_MESSAGES=C        LC_PAPER=C
> >      [8] LC_NAME=C            LC_ADDRESS=C         LC_TELEPHONE=C
>  LC_MEASUREMENT=C     LC_IDENTIFICATION=C
> >
> >     attached base packages:
> >     [1] grid      stats     graphics  grDevices utils     datasets
> methods   base
> >
> >     other attached packages:
> >      [1] stringr_0.6.2          RGoogleAnalytics_0.1.1 httr_0.5
>      lubridate_1.3.2        extrafont_0.16         scales_0.2.3
> >      [7] httpuv_1.3.0           reshape_0.8.5          gridExtra_0.9.1
>       plyr_1.8               rjson_0.2.13           RCurl_1.95-4.1
> >     [13] bitops_1.0-6           ggplot2_0.9.3.1        data.table_1.9.3
>      RJDBC_0.2-1            rJava_0.9-4            DBI_0.2-7
> >
> >     loaded via a namespace (and not attached):
> >      [1] MASS_7.3-29        RColorBrewer_1.0-5 Rcpp_0.11.1
> Rttf2pt1_1.3.2     colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3
>  extrafontdb_1.0
> >      [9] gtable_0.1.2       jsonlite_0.9.11    labeling_0.2
>  memoise_0.1        munsell_0.4.2      proto_0.3-10       reshape2_1.2.2
>  tools_3.0.2
> >
> >
> >
> >
> >     Meu OS é Linux GNU Ubuntu 12.04
> >
> >     Grato,
> >     Manoel
> >     --
> >     Manoel Galdino
> >     https://sites.google.com/site/galdinomcz/
> >
> >
> >
> >
> > --
> > Manoel Galdino
> > https://sites.google.com/site/galdinomcz/
> >
> >
> > _______________________________________________
> > R-br mailing list
> > R-br em listas.c3sl.ufpr.br
> > https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
> > Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
> código mínimo reproduzível.
> >
>
>
> _______________________________________________
> R-br mailing list
> R-br em listas.c3sl.ufpr.br
> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça
> código mínimo reproduzível.
>



-- 
Manoel Galdino
https://sites.google.com/site/galdinomcz/
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20140915/73c8fdb3/attachment.html>


Mais detalhes sobre a lista de discussão R-br