[R] Bug?

Ramiro Barrantes ramiro at precisionbioassay.com
Tue Aug 8 20:39:13 CEST 2017


Hello,

In my code I found something that looks like an anomaly, I found a reproducible example in which I am just trying to compare each row in a data frame against the first row:

a<-data.frame(row=c("B","C","B"),column=c(2,2,10),assay=c("Assay1","Assay1","Assay1"),plate=c(1,1,1),stringsAsFactors=FALSE)
apply(a[1:2,],1,function(x) { all(x==a[1,]) })
apply(a[1:3,],1,function(x) { all(x==a[1,]) })
> >     1     2
 TRUE FALSE
>     1     2     3
FALSE FALSE FALSE
>

The second result is not right, it should be TRUE FALSE FALSE

Am I doing something wrong or is this a bug?  With other inputs it seems to work ok

Here is my sessionInfo()
> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.9 (Final)

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=en_US.UTF-8    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 utils     datasets  methods   base
>

Thank you,
Ramiro



Ramiro Barrantes Ph.D.
Precision Bioassay, Inc.
431 Pine St., Suite 110
Burlington, VT 05401
802 865 0155
802 861 2365 FAX
www.precisionbioassay.com<https://west.exch023.serverdata.net/owa/redir.aspx?SURL=wN3KzpoKXAcetH7sTOTnSyfg-iAXFIinpPUtRcduCFCtkgZrUSDTCGgAdAB0AHAAOgAvAC8AdwB3AHcALgBwAHIAZQBjAGkAcwBpAG8AbgBiAGkAbwBhAHMAcwBhAHkALgBjAG8AbQA.&URL=http%3a%2f%2fwww.precisionbioassay.com>
ramiro at precisionbioassay.com

CONFIDENTIALITY NOTICE: This email, including any attach...{{dropped:9}}



More information about the R-help mailing list