Hi Simon and Peter

Ouch, I am sorry for raising this.

I hadn't even considered that this basic functionality might only have entered R between 2.10 and 2.11 - and that trying to use it would not raise an error pre-2.11.

The Windows PC was that of a student, which is a lame non-excuse for not trying with 2.11 there.

        Sorry again for wasting your time, and best wishes
        Wolfgang




Simon Urbanek scripsit 02/12/2010 07:15 PM:

On Feb 12, 2010, at 12:50 , Wolfgang Huber wrote:

Hi,

when running the following on different instances of R (Linux and Windows), I get different results. The one for Linux seems to be the intended / documented one. When using numeric indices rather than characters, Windows seemed to behave as expected.


AFAICT this has nothing to do with the platform but with using an older R version in Windows that doesn't support it ...

 From NEWS:

                CHANGES IN R VERSION 2.11.0
[...]
NEW FEATURES
[...]
    o   n-dimensional arrays with dimension names can now be indexed
        by an n-column character matrix. The indices are matched
        against the dimension names.  NA indices are propagated to the
        result.  Unmatched values and "" are not allowed and result in
        an error.


Cheers,
Simon



-----------On Windows--------------

x = matrix(FALSE, nrow=3, ncol=3)
colnames(x) = LETTERS[1:3]
rownames(x) = letters[1:3]
x

#       A     B     C
# a FALSE FALSE FALSE
# b FALSE FALSE FALSE
# c FALSE FALSE FALSE

x [ cbind("b", "B") ] = TRUE
x
                                                         b     B
# FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE

sessionInfo()

R version 2.10.0 (2009-10-26)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


-----------On Linux--------------
x = matrix(FALSE, nrow=3, ncol=3)
colnames(x) = LETTERS[1:3]
rownames(x) = letters[1:3]
x
#       A     B     C
# a FALSE FALSE FALSE
# b FALSE FALSE FALSE
# c FALSE FALSE FALSE
x [ cbind("b", "B") ] = TRUE
x
#       A     B     C
# a FALSE FALSE FALSE
# b FALSE  TRUE FALSE
# c FALSE FALSE FALSE

> sessionInfo()
R version 2.11.0 Under development (unstable) (2010-02-12 r51125)
x86_64-unknown-linux-gnu

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
[1] fortunes_1.3-7




--

Best wishes
    Wolfgang


--
Wolfgang Huber
EMBL
http://www.embl.de/research/units/genome_biology/huber/contact

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





--

Best wishes
     Wolfgang


--
Wolfgang Huber
EMBL
http://www.embl.de/research/units/genome_biology/huber/contact

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

Reply via email to