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 (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...

Thank you

Adam

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to