[Rd] inconsistent error messages on Mac OS X

Dan Tenenbaum dtenenba at fhcrc.org
Thu Apr 3 00:32:22 CEST 2014



----- Original Message -----
> From: "Adam Welc" <adamwelc at yahoo.com>
> To: r-devel at r-project.org
> Sent: Wednesday, April 2, 2014 3:11:28 PM
> Subject: [Rd] inconsistent error messages on Mac OS X
> 
> Hi All,
> 
> I am one of the contributors to the FastR project (
> https://bitbucket.org/allr <https://bitbucket.org/allr.>) and I have
> encountered an interesting issue when trying to implement vector
> accesses
> within FastR. I am trying to understand what kind of error message
> should
> be generated for the following expression:
> 
> x<-1:4; x[[1]]<-NULL; x
> 
> In order to determine the error message, I ran the shell of standard
> GNU R
> (installed via MacPorts - R version 2.15.3) on Mac OS X 10.8.5 as
> follows,
> with R metadata (that is .RData or .Rhistory files) removed from the
> current directory 

Instead you should probably start R as follows:

R --vanilla

?Startup explains why removing .RData etc from the current directory is not enough, in the absence of --vanilla.

>(I have edited portions of the R header printed
> when the
> shell starts for the sake for readability):
> 
> Adams-MacBook-Air:work adam$ R
> 
> R version 2.15.3 (2013-03-01) -- "Security Blanket"
> Copyright (C) 2013 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> Platform: x86_64-apple-darwin12.3.0/x86_64 (64-bit)
> ...
> ...
> Type 'q()' to quit R.
> 
> > x<-1:4; x[[1]]<-NULL; x
> Error in x[[1]] <- NULL :
>   incompatible types (from NULL to integer) in [[ assignment
> > q()
> Save workspace image? [y/n/c]: n
> 
> 
> Adams-MacBook-Air:work adam$ R
> 
> R version 2.15.3 (2013-03-01) -- "Security Blanket"
> Copyright (C) 2013 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> Platform: x86_64-apple-darwin12.3.0/x86_64 (64-bit)
> ...
> ...
> Type 'q()' to quit R.
> 
> > x<-1:4; x[[1]]<-NULL; x
> Error in x[[1]] <- NULL :
>   more elements supplied than there are to replace
> >
> 
> 
> As you can see, the error message for the same expression is
> different on
> two subsequent executions of the GNU R shell (with no workspace image
> saving - but it does not matter, as I observe the same behavior if
> the
> workspace is saved).
> 
> I tried the same thing on Linux, but there the behavior seems
> consistent
> (the second message is displayed in each execution).
> 
> This issue is not specific to this single expression - it happens in
> other
> (though not all) cases when the NULL value is assigned to an element
> of a
> vector.
> 
> I was wondering if someone has observed the same behavior and perhaps
> knows
> what may be causing it...
> 

I can't reproduce this on 
R Under development (unstable) (2013-10-12 r64048)

with or without --vanilla, it consistently gives the second error message.

Dan


> Thank you
> 
> Adam
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list