I just setup a Ubuntu 14.04 web server and change locale to zh_CN.UTF-8. However ggplot2 cannot show the Chinese characters in labels.
library(ggplot2)
x_lab <- enc2utf8('中国')
p <- ggplot(cars) + geom_point(aes(speed, dist)) +
xlab(x_lab)
png('a.png')
print(p)
dev.off()
The results look like this
Any idea to fix this problem?
PS: I have another web server with the same locale, but work fine to me.
This is my sessionInfo
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
locale:
[1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.1.0
loaded via a namespace (and not attached):
[1] colorspace_1.2-6 scales_0.4.0 plyr_1.8.4 gtable_0.2.0
[5] Rcpp_0.12.6 grid_3.3.1 munsell_0.4.3
Figure out this problem. I need to install Chinese fonts in the new server, then roboot:
sudo apt-get install fonts-wqy-zenhei
sudo apt-get install fonts-arphic-bkai00mp fonts-arphic-bsmi00lp fonts-arphic-gbsn00lp fonts-arphic-gkai00mp fonts-arphic-ukai fonts-arphic-uming fonts-cns11643-kai fonts-cns11643-sung fonts-cwtex-fs fonts-cwtex-heib fonts-cwtex-kai fonts-cwtex-ming fonts-cwtex-yen
See this page: https://askubuntu.com/questions/490829/how-can-i-install-chinese-fonts-on-kubuntu-14-04
Related
I am trying to install some packages (quite basic ones actually) for R 3.6, but I'm getting a fairly strange error message from BiocManager::install():
BiocManager::install("XML", destdir = "/my/dir/R/x86_64-pc-linux-gnu-library/3.6/")
error: could not load shared object '/my/dir/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-XML/00new/XML/libs/XML.so':
libicui18n.so.58: Could not open shared object file: No such file or directory
(Translated from french - could be approximate)
Does this mean that R can't write in /my/dir/R/x86_64-pc-linux-gnu-library/3.6/? That would be my first idea but I really don't know.
EDIT:
Here is my session info:
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=C
[4] LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=C LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocManager_1.30.10
loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2
This is a configuration problem, there is a fix available at github.com/r-lib/xml2/issues/219.
This question is similar to this post, but the response there doesn't really give what I need.
Context:
After I edit the R script on RStudio, it pops out an error message and says: "Error Saving File: No such file or directory". At the same time, I can't open any script also (error message: "Error while opening file: no such file or directory". (a permissions issue?)
I've been having this problem for a while now, and the solution from other posts doesn't seem to work for my situation. Including:
clear the sdb (source data based) directory inside ~/.rstudio (Rstudio support)
deleting ~/.rstudio and restart the R session (Rstudio support)
sudo chown -R $(whoami) ~/.rstudio* (Github)
I'm using R server (1.1.423) with Microsoft Azure on Ubuntu 16.04.3 xenial.
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.1.0 haven_1.1.1 dplyr_0.5.0 zoo_1.8-1 readxl_1.0.0 RODBC_1.3-15
[7] lubridate_1.7.3 svMisc_1.0-2 data.table_1.10.0 rstudioapi_0.7
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 lattice_0.20-35 assertthat_0.1 R6_2.2.2 grid_3.4.3 cellranger_1.1.0
[7] DBI_0.5-1 magrittr_1.5 stringi_1.1.2 forcats_0.3.0 tools_3.4.3 compiler_3.4.3
[13] tibble_1.2
> RStudio.Version()
$citation
To cite RStudio in publications use:
RStudio Team (2016). RStudio: Integrated Development for R. RStudio, Inc., Boston, MA URL
http://www.rstudio.com/.
A BibTeX entry for LaTeX users is
#Manual{,
title = {RStudio: Integrated Development Environment for R},
author = {{RStudio Team}},
organization = {RStudio, Inc.},
address = {Boston, MA},
year = {2016},
url = {http://www.rstudio.com/},
}
$mode
[1] "server"
$version
[1] ‘1.1.423’
I have a downloadHandler() in Shiny that generates an html document using R markdown. This document generates rgl plots, which are added to the document using hook_webgl. The application is running on a Shiny server. Everything works fine the first time the download button is used, but on the following occasions I get the error "You must enable Javascript to view this page properly". I am using rglwidgets, but I get the same issues using shinyRGL.
> sessionInfo()
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.13.2 rmarkdown_0.9.5 knitr_1.12.3 rglwidget_0.1.1434
[5] rgl_0.95.1441
loaded via a namespace (and not attached):
[1] htmlwidgets_0.6 magrittr_1.5 R6_2.1.2 tools_3.2.4
[5] htmltools_0.3.5 Rcpp_0.12.4 jsonlite_0.9.19 digest_0.6.9
[9] xtable_1.8-2 httpuv_1.3.3 mime_0.4
I'd like to install this Package from bitbucket: https://bitbucket.org/mkuhn/parallelrandomforest/
But this is what happends if i run install_bitbucket
> devtools::install_bitbucket("mkuhn/parallelrandomforest")
Downloading bitbucket repo mkuhn/parallelrandomforest#master
Error in download(dest, src, auth) : client error: (404) Not Found
If i run the command from ?install_bitbucket namely install_bitbucket("dannavarro/lsr-package") it works perfectly.
Any ideas
R version 3.1.2 (2014-10-31)
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
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] RCurl_1.95-4.5 bitops_1.0-6 devtools_1.7.0 httr_0.6.1 stringr_0.6.2 tools_3.1.2
Usually the master branch should be called master, but they managed to call it default.
devtools::install_bitbucket("mkuhn/parallelrandomforest#default")
I'm switching from Sweave to knitr and like it very much. Big THANKS to Yihui!
One thing that keeps annoying me is that plot windows pop up and get active. So when I write while knitr is working, my editor looses focus every so often. This happens even if there's no plot produced in the code chunk.
Is there a way to avoid this?
Here's my sessionInfo (), in case that helps:
R version 2.15.0 (2012-03-30)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
[3] LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] hyperSpec.sim_0.5 mvtnorm_0.9-9992 hyperSpec_0.98-20120531
[4] lattice_0.20-6 knitr_0.5
loaded via a namespace (and not attached):
[1] arrayhelpers_0.75-20120531 codetools_0.2-8
[3] digest_0.5.2 evaluate_0.4.2
[5] formatR_0.4 highlight_0.3.1
[7] parser_0.0-14 plyr_1.7.1
[9] Rcpp_0.9.10 stringr_0.6
[11] tools_2.15.0
This must have been fixed in a commit last week. There will not be plot windows opened any more. If you do not know how to install the development version, you will wait for about one week for the next CRAN release, otherwise just install from Github.