Tal Galili wrote on 12/29/2011 10:52:55 AM:

> Hello all,
> 
> The following line of code includes a right-to-left language text, yet 
the
> R graphics engine displays it from left to right.  One problem this 
causes
> is when there are parenthesis in the test, here is a basic example?
> 
> plot(1:10, main = "ש×?×?ם (×?קס×?)")
> 
> Is there a way to make sure the text is displayed from right to left?
> 
> Many thanks for any suggestions,
> Tal
> 
> 
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> 
----------------------------------------------------------------------------------------------


I'm not sure if this is what you're after, but this function reverses the 
string, character by character and swaps parentheses around.

rev.string <- function(x) {
        revx.indiv <- rev(unlist(strsplit(x, "")))
        revx.indiv2 <- revx.indiv
        revx.indiv2[revx.indiv=="("] <- ")"
        revx.indiv2[revx.indiv==")"] <- "("
        paste(revx.indiv2, collapse="")
        }
plot(1:10, main=rev.string("ש×?×?ם (×?קס×?)"))


Jean
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to