[R] Creating a package with specail caracters

peter dalgaard pdalgd at gmail.com
Thu Oct 15 11:55:11 CEST 2015


> On 15 Oct 2015, at 09:52 , jpara3 <j.para.fernandez at hotmail.com> wrote:
> 
> Hi, 
> 
> I want to create my own package with a very simple GUI. The problem is that
> I need to use special latin characters, as ¿,¡,ñ...
> 
> The function i have made is:
> 
> funcion<-function(){
> tt<-tktoplevel()
> tktitle(tt)<-"¡GUI de estadística"
> }
> 
> 
> The problem is that when i run this function, instead estadística, appears
> some strange simbols. How can I convert this to latin1??
> 
> Thanks!!!:
> 
> 

I think it is the other way around: Tcl/Tk speaks UTF-8, so if you run R in a Latin-1 locale, you need to translate the strings to UTF-8. iconv() is your friend.

I'm a bit puzzled, though. The underlying C function RTcl_ObjFromCharVector tries to be smart about encodings, and the only way I can reproduce anything looking like your issue is if I do sneaky things like 

> x <- iconv("¡GUI de estadística", to="latin1")
> Encoding(x) <- "UTF8"
> tktitle(tt)<-x
> x
[1] "\xa1GUI de estad\xedstica"

-pd

BTW: Notice that the Nabble interface is closing down. You need to use the mailing list directly.

> View this message in context: http://r.789695.n4.nabble.com/Creating-a-package-with-specail-caracters-tp4713615.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list