Skip to content

invalid \uxxxx sequence while trying to create a package

7 messages · Charles Annis, P.E., Duncan Murdoch, Brian Ripley

#
On 18/03/2008 5:17 PM, Charles Annis, P.E. wrote:
The \uxxxx sequences are Unicode characters.  The xxxx are supposed to 
be hexadecimal digits.  So you might have something like

cat("\u00B7")

to display a dot.  "Invalid" means it's not recognized, or not well-formed.

So what I'd suggest is to search your source code for \u, and see if you 
inadvertantly included this for some other purpose.  Alternatively, it's 
possible something has translated a non-Ascii character into a \uxxxx 
sequence; I don't know what might have done that.

If none of that works, you could try reporting on what versions of 
everything you're using.  You didn't mention that yet.  And if they are 
all currrent versions (R 2.6.2, Rtools 2.7) then I guess you'll just 
have to divide and conquer: cut out half the source code and see if you 
still get the error.  If so, cut it again, if not, look in the other half.

Duncan Murdoch
#
Thank you Duncan:

I found the culprit - my menu contains lines like this one:

winMenuAdd(menuname = "mh1823/\u00e2 vs a/2.  Build \u00e2 vs a Linear
Model")

This does produce a menu item that looks like ? vs a and since R doesn't
seem to like the a-hat character I tried to get around the objection with
the corresponding Unicode character(s), obviously with no success.

The menu works perfectly well, but can't be packaged as it currently is
using R CMD build --binary March18.  Is there no way for me to package the
menu?  

Thanks, again.

Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Duncan Murdoch
Sent: Tuesday, March 18, 2008 6:08 PM
To: Charles.Annis at statisticalengineering.com
Cc: r-help at r-project.org
Subject: Re: [R] invalid \uxxxx sequence while trying to create a package
On 18/03/2008 5:17 PM, Charles Annis, P.E. wrote:
before,
version
with
c:\DOCUME~1\CHARLE~1\LOCALS~1\Temp\Rbuild142865646\March18\chm\March18.chm,
don't
The \uxxxx sequences are Unicode characters.  The xxxx are supposed to 
be hexadecimal digits.  So you might have something like

cat("\u00B7")

to display a dot.  "Invalid" means it's not recognized, or not well-formed.

So what I'd suggest is to search your source code for \u, and see if you 
inadvertantly included this for some other purpose.  Alternatively, it's 
possible something has translated a non-Ascii character into a \uxxxx 
sequence; I don't know what might have done that.

If none of that works, you could try reporting on what versions of 
everything you're using.  You didn't mention that yet.  And if they are 
all currrent versions (R 2.6.2, Rtools 2.7) then I guess you'll just 
have to divide and conquer: cut out half the source code and see if you 
still get the error.  If so, cut it again, if not, look in the other half.

Duncan Murdoch

______________________________________________
R-help at 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.
2 days later
#
I'm running R2.6.2 on a DELL box with 2gig RAM, using Rtools (v26).

I have a perplexing problem trying to build a package.  

I've created a small demonstration:

problem.demo  <- function () 
{cat("\n          ***   \u00e2 vs a    ***\n")}


This function runs in an R gui session and Rtools makes a simple package
containing it alone or with a handful of similar routines.

However, when I include it with a much bigger package (that Rtools has no
trouble in packaging without it), the result is an invalid \uxxxx sequence:

Compile time: 0 minutes, 3 seconds
171     Topics
342     Local links
171     Internet links
1       Graphic


Created
c:\DOCUME~1\CHARLE~1\LOCALS~1\Temp\Rbuild406495938\mh1823\chm\mh1823.chm,
149,803 bytes
Compression decreased file by 398,668 bytes.
  preparing package mh1823 for lazy loading
Loading required package: rcom
Loading required package: RODBC
Loading required package: RColorBrewer
Loading required package: survival
Loading required package: splines
Error in parse(n = -1, file = file) : invalid \uxxxx sequence
Calls: <Anonymous> -> code2LazyLoadDB -> sys.source -> parse
Execution halted
make: *** [lazyload] Error 1
*** Installation of mh1823 failed ***

Removing 'C:/DOCUME~1/CHARLE~1/LOCALS~1/Temp/Rinst406445831/mh1823'

Clearly I am overlooking something obvious, so I would greatly appreciate
any guidance.

Thanks.


Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
#
On 21/03/2008 6:01 PM, Charles Annis, P.E. wrote:
The general rules apply.

"Make it reproducible".

You've done that for yourself, but you haven't given instructions that 
let anyone else reproduce it.

If you simplify your example to a minimal one that reproduces the error, 
there's a good chance you'll spot what is wrong:  but if not, there's a 
good chance someone else will be able to.

If you post error messages without the code that causes them, there 
might be one person on the list who can diagnose the problem, but he's 
awfully busy.  Post complete instructions for reproducing it.

Duncan Murdoch
#
Now, I wonder who Duncan meant by

    'one person on the list who can diagnose the problem'

?

Hint: small packages are not selected for lazyloading, so do your example 
with lazy loading set in the DESCRIPTION file.

If I do that, the example runs in R-devel but not in 2.6.2.  It is 
a locale issue: the C locale is used where that sequence is not valid.
(This is necessary: it is not valid in Japanese either and the run-time 
locale need not be the same as the install-time locale -- fortunately for 
the distribution of binary packages.)

I would suggest that you do not use \uxxxx sequences on Windows until 
2.7.0.  Here \xe2 will work equally well, or if you want to be as portable 
as possible iconv("\xe2", "latin1", "").  Or turn lazyloading off and rely 
on run-time parsing.
On Fri, 21 Mar 2008, Duncan Murdoch wrote:

            

  
    
#
Thank you, Professor Ripley!

LazyLoad:FALSE in my DESCRIPTION file was the charm!  

(It took a bit of looking to determine the correct syntax.  A search for
"lazyloading" in "Writing R Extensions" was a red herring, but a search on
CRAN suggesting "lazy loading"  - obvious in hindsight, of course -  sent me
back to "Writing ..." and the correct syntax.)

Thank you very much for the rescue.  (I will revisit lazy loading when
R-2.7.0 arrives.)

Again, my sincere gratitude!


Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Prof Brian Ripley
Sent: Saturday, March 22, 2008 3:50 AM
To: Duncan Murdoch
Cc: r-help at r-project.org; Charles.Annis at statisticalengineering.com
Subject: Re: [R] invalid \uxxxx sequence while trying to create a package

Now, I wonder who Duncan meant by

    'one person on the list who can diagnose the problem'

?

Hint: small packages are not selected for lazyloading, so do your example 
with lazy loading set in the DESCRIPTION file.

If I do that, the example runs in R-devel but not in 2.6.2.  It is 
a locale issue: the C locale is used where that sequence is not valid.
(This is necessary: it is not valid in Japanese either and the run-time 
locale need not be the same as the install-time locale -- fortunately for 
the distribution of binary packages.)

I would suggest that you do not use \uxxxx sequences on Windows until 
2.7.0.  Here \xe2 will work equally well, or if you want to be as portable 
as possible iconv("\xe2", "latin1", "").  Or turn lazyloading off and rely 
on run-time parsing.
On Fri, 21 Mar 2008, Duncan Murdoch wrote:

            
sequence:
http://www.R-project.org/posting-guide.html