On 12-10-28 10:57 AM, Eva Prieto Castro wrote:
Hi Duncan:
The problem is that in Windows I can't do the source() with
encoding="utf-8", so I don't reach the step of adjusting DESCRIPTION file.
The DESCRIPTION file is a plain text file, not R code. You don't need
to source() it, you just edit it in a plain text editor (e.g. Windows
notepad). Many editors can read and write a variety of encodings.
Notepad can handle ANSI (their name for the local encoding, usually
something like latin1 in western languages) and UTF-8. I'd recommend
using ANSI, because notepad will probably write a "byte-order mark" that
will confuse some other systems.
So if you can view all the files in notepad and they look okay, then
save them using ANSI, and add the line
Encoding: latin1
to the DESCRIPTION file, and MacOS should be able to handle the package.
If you have a better editor I'd choose UTF-8 with no byte-order mark.
Duncan Murdoch
Eva
--- El *dom, 28/10/12, Duncan Murdoch /<murdoch.dun...@gmail.com>/*
escribió:
De: Duncan Murdoch <murdoch.dun...@gmail.com>
Asunto: Re: [R] Encoding
Para: "Eva Prieto Castro" <evapcas...@yahoo.es>
CC: r-help@r-project.org
Fecha: domingo, 28 de octubre, 2012 14:05
On 12-10-28 7:56 AM, Eva Prieto Castro wrote:
>
> Hi Duncan,
>
> What dos it happen if I need use non-ASCII characters?. Is there
no way
> in order to make the package in Windows PC and it runs on Mac?.
As I said: always use the same encoding for them, and declare it in the
DESCRIPTION file. See the paragraph on this in the DESCRIPTION file
section 1.1.1 of the Writing R Extensions manual. There's more advice
in section 1.7.1 "Encoding issues" of that manual.
Duncan Murdoch
>
> I am lost, very lost.
>
> Thanks.
>
> Eva
> --- El *dom, 28/10/12, Duncan Murdoch /<murdoch.dun...@gmail.com
</mc/compose?to=murdoch.dun...@gmail.com>>/*
> escribió:
>
>
> De: Duncan Murdoch <murdoch.dun...@gmail.com
</mc/compose?to=murdoch.dun...@gmail.com>>
> Asunto: Re: [R] Encoding
> Para: "Eva Prieto Castro" <evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>
> CC: r-help@r-project.org </mc/compose?to=r-help@r-project.org>
> Fecha: domingo, 28 de octubre, 2012 12:05
>
> On 12-10-28 3:49 AM, Eva Prieto Castro wrote:
> > Hi again, Duncan:
> >
> > I understand you tell me, but I don't reach it runs in
Mac. How
> must I do?.
>
> There is a function in the tools package called
showNonASCIIfile. If
> you run it on each source file in your package, you may
detect other
> non-ASCII characters besides the degree symbol.
>
> Duncan Murdoch
>
> >
> > Thanks.
> >
> > Eva
> >
> > --- El *sáb, 27/10/12, Duncan Murdoch
/<murdoch.dun...@gmail.com </mc/compose?to=murdoch.dun...@gmail.com>
> </mc/compose?to=murdoch.dun...@gmail.com
</mc/compose?to=murdoch.dun...@gmail.com>>>/*
> > escribió:
> >
> >
> > De: Duncan Murdoch <murdoch.dun...@gmail.com
</mc/compose?to=murdoch.dun...@gmail.com>
> </mc/compose?to=murdoch.dun...@gmail.com
</mc/compose?to=murdoch.dun...@gmail.com>>>
> > Asunto: Re: [R] Encoding
> > Para: "Eva Prieto Castro" <evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>>
> > CC: r-help@r-project.org
</mc/compose?to=r-help@r-project.org>
</mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>>
> > Fecha: sábado, 27 de octubre, 2012 14:12
> >
> > On 12-10-27 7:28 AM, Eva Prieto Castro wrote:
> > > Hi again:
> > >
> > > I could make tha package (in Windows 7) but it does not
> run in Mac.
> > >
> > > Please could you tell me how to make a package in
Windows
> PC with
> > source code saved in utf-8 in the way the package runs
on a Mac ?
> >
> > One likely problem is that you need to declare in the
> DESCRIPTION file
> > which encoding you are using. The other problem is
that you
> may not be
> > consistently using UTF-8 encodings. Since your system (as
> shown below)
> > defaults to Latin1, files produced by R will default
to Latin1
> > encoding.
> > If you consistently use Latin1 and declare that in the
> DESCRIPTION,
> > your Mac should be able to work with the package.
> >
> > In your other message you mentioned Unicode and
UCS-2. UCS-2
> is not
> > UTF-8, they are different. "Unicode" is ambiguous, but on
> Windows it
> > generally means UCS-2. As you found, R can read that, but
> it's not
> > used
> > by default, so I would avoid it.
> >
> > One other approach to this is to avoid non-ASCII
characters.
> Then
> > UTF-8
> > and Latin1 are the same, and you won't run into problems.
> But if you
> > are writing Spanish, that's not easy.
> >
> > Duncan Murdoch
> >
> > >
> > > In my pc (where I create the package) :
> > >> l10n_info()
> > > $MBCS
> > > [1] FALSE
> > >
> > > $`UTF-8`
> > > [1] FALSE
> > >
> > > $`Latin-1`
> > > [1] TRUE
> > >
> > > $codepage
> > > [1] 1252
> > >
> > >
> > > Thanks.
> > >
> > > Eva
> > >
> > > --- El sáb, 27/10/12, Eva Prieto Castro
> <evapcas...@yahoo.es </mc/compose?to=evapcas...@yahoo.es>
</mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>
> > </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>>> escribió:
> > >
> > > De: Eva Prieto Castro <evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>
> > </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>>>
> > > Asunto: Re: Encoding
> > > Para: r-help@r-project.org
</mc/compose?to=r-help@r-project.org>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>>>
> > > Fecha: sábado, 27 de octubre, 2012 08:48
> > >
> > > Hi,
> > >
> > > I solved the problem as follows:
> > >
> > > source(file="example.R", encoding="UCS-2")
> > >
> > > Thanks
> > >
> > > Eva
> > >
> > > --- El sáb, 27/10/12, Eva Prieto Castro
> <evapcas...@yahoo.es </mc/compose?to=evapcas...@yahoo.es>
</mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>
> > </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>>> escribió:
> > >
> > > De: Eva Prieto Castro <evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>
> > </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>
> </mc/compose?to=evapcas...@yahoo.es
</mc/compose?to=evapcas...@yahoo.es>>>>
> > > Asunto: Encoding
> > > Para: r-help@r-project.org
</mc/compose?to=r-help@r-project.org>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>
> </mc/compose?to=r-help@r-project.org
</mc/compose?to=r-help@r-project.org>>>
> > > Fecha: sábado, 27 de octubre, 2012 07:34
> > >
> > > Hi,
> > >
> > > I work with R on Windows, so I use ANSI encode; but
when I
> run my
> > projects on a linux or mac pc, It fails, so I change the
> encoding to
> > unicode (in the same mac pc) and runs ok.
> > >
> > > The problema is that I need tu make the package in
mi pc
> > (windows) and when I
> > > save my sources as unicode it fails: I make
> source("mydile.R")
> > and it return tle following:
> > >
> > > Error en eval(expr, envir, enclos) : objeto 'ÿþ' no
encontrado
> > >
> > > How can I resolve it?. I need to make the package in a
> windows pc
> > ant it may run ok on all the OS.
> > >
> > > Thanks in advance.
> > >
> > > Eva
> > >
> > > [[alternative HTML version deleted]]
> > >
> > >
> > >
> > > ______________________________________________
> > > R-help@r-project.org
</mc/compose?to=R-help@r-project.org>
</mc/compose?to=R-help@r-project.org
</mc/compose?to=R-help@r-project.org>>
> </mc/compose?to=R-help@r-project.org
</mc/compose?to=R-help@r-project.org>
> </mc/compose?to=R-help@r-project.org
</mc/compose?to=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.
> > >
> >
>
______________________________________________
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.