Question: Error: Missign value where TRUE/FALSE needed when using rbind in R
1
gravatar for AsoInfo
3.5 years ago by
AsoInfo300
Bonn, Germany
AsoInfo300 wrote:

Greetings!

I am doing some analysis in R using sqldf package. The file contains SQL queries of OrthoMCL. It is working fine for the small files but with the larger files (Size of the file is 26 GB) it started to give me error:

Error in if (n > 0) c(NA_integer_, -n) else integer() :

missing value where TRUE/FALSE needed

Calls: rbind -> rbind -> structure -> .set_row_names

In addition: Warning messages:

1: In Make.row.names(nmi, ri, ni, nrow):

NAs introduced by coercion to integer range

2: In nrow + ni : NAs produced by integer overflow

I am unable to understand the rbind error. I looked at other question (Error with fdrtool in R ) having similar error but I couldn't figure it out. The code for rbind is written as follows:

BestHit2 <- list()
for (i in 1:length(args)){
  b <- read.table(args[i],sep="\t",header=T)
  BestHit2 <- rbind(BestHit2,b)
}

Any help would be appreciated!

sql orthomcl R • 3.1k views
ADD COMMENTlink modified 19 months ago by Biostar ♦♦ 20 • written 3.5 years ago by AsoInfo300
3
gravatar for Santosh Anand
3.5 years ago by
Santosh Anand5.2k
Santosh Anand5.2k wrote:

What is the purpose of using rbind on list element? Probably you need BestHit2 as a data.frame?

From rbind/cbind help page

Take a sequence of vector, matrix or data-frame arguments and combine by columns or rows, respectively. These are generic functions with methods for other R classes.

ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by Santosh Anand5.2k

Yes, I need BestHit2 as a data frame.

ADD REPLYlink written 3.5 years ago by AsoInfo300
2

Then initialize it as data.frame (eg. for 5 columns)

data.frame(matrix(nrow=0,ncol=5))

Also check that all the tables have same number of columns.

1: In Make.row.names(nmi, ri, ni, nrow):

NAs introduced by coercion to integer range

This makes me believe that some of the tables have no headers and you are trying to read the headers!

ADD REPLYlink modified 3.5 years ago • written 3.5 years ago by Santosh Anand5.2k

Yeah, I am doing it and so far it seems working. I'll update you further.

ADD REPLYlink written 3.5 years ago by AsoInfo300

Yeah, I sorted everything you said and it is working fine now. Thanks!

ADD REPLYlink written 3.5 years ago by AsoInfo300

Happy that it is resolved.

ADD REPLYlink written 3.5 years ago by Santosh Anand5.2k

Can you please put your comment as an answer? So I can accept it. Thanks!

ADD REPLYlink written 3.5 years ago by AsoInfo300

done that, thanks!!!

ADD REPLYlink written 3.5 years ago by Santosh Anand5.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1060 users visited in the last hour
_