Yes, I need BestHit2 as a data frame.
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!
1 answer
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.
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!
Yeah, I am doing it and so far it seems working. I'll update you further.
Log in to answer this question.