[R] non-ascii characters in R output

Matt Shotwell Matt.Shotwell at Vanderbilt.Edu
Fri Feb 18 19:47:18 CET 2011


All,

I'd like to automatically output text from R to HTML. In doing this I've 
run into trouble with non-ascii characters, as my browser (and 
presumably others) does not render such characters correctly. For 
example, the 'fancy' single quotes associated with summary.lm are 
multi-byte characters on my platform. This particular problem is solved 
by options(useFancyQuotes=FALSE). But now I'm concerned about other 
non-ascii characters. As an overkill maybe, my current solution involves 
capture.output and iconv(..., to="ASCII//TRANSLIT"). Are there other 
sources of non-ascii character? Is there a better or general solution?

Best,
Matt

 > sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-pc-linux-gnu (64-bit)

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=C              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

loaded via a namespace (and not attached):
[1] tools_2.12.1

-- 
Matthew S Shotwell   Assistant Professor           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list