What is the meaning of this error "Error in if (any(B < 1)) stop("B too small")" while using tabplot package
Asked Answered
H

2

6

I found the tabplot package for visualizin a large data base. I ran it using the code below but I get this error on different data frames:

"Error in if (any(B < 1)) stop("B too small") : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In bbatch(n, as.integer(BATCHBYTES/theobytes)) : NAs introduced by coercion"

Here is an example:

dat <- read.table(text = " birds    wolfs     snakes
                     3        9         7
                     3        8         4
                     1        2         8
                     1        2         3
                     1        8         3
                     6        1         2
                     6        7         1
                     6        1         5
                     5        9         7
                     3        8         7
                     4        2         7
                     1        2         3
                     7        6         3
                     6        1         1
                     6        3         9
                     6        1         1   ",header = TRUE)
install.packages("tabplot")
package ‘ff’ successfully unpacked and MD5 sums checked
package ‘bit’ successfully unpacked and MD5 sums checked
package ‘fastmatch’ successfully unpacked and MD5 sums checked
package ‘ffbase’ successfully unpacked and MD5 sums checked
package ‘tabplot’ successfully unpacked and MD5 sums checked
library("tabplot", lib.loc="~/R/win-library/3.1")
 tab <- tableplot(dat, plot = FALSE) ## The tabplot  command
Error in if (any(B < 1)) stop("B too small") : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In bbatch(n, as.integer(BATCHBYTES/theobytes)) : NAs introduced by coercion

Any Idea how to overcome this issue?

UPDATE - I used another computer and it works fine.Both computers are on Windows 64-bit but on the computer that I got it to work the OS is Win7 pro and on the computer that has the error the OS is WIN SERVER 2013

Heng answered 4/5, 2015 at 9:59 Comment(2)
I only get a warning (v. 1.1). What version of the package are you using?Bradybradycardia
At this point, I think we will need a reproducible example. Can anyone reconfirm the error?Bradybradycardia
V
2

According to a comment by schuemie, this error has to do with the amount of memory needed by ffdfdlpy, and can be fixed with a per-session run of

options(ffmaxbytes = min(getOption("ffmaxbytes"),.Machine$integer.max * 12))

will allow this to work.

I can confirm this works with sessionInfo():

R version 3.2.4 (2016-03-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Voluminous answered 16/3, 2016 at 15:25 Comment(0)
H
1

The problem lies in the command bbatch(n, as.integer(BATCHBYTES/theobytes)). Whatever you are doing is causing NAs to be introduced when integers are expected. And any(NA < 1) gives NA. This has the effect that the if() command can't decide if your value is TRUE or FALSE:

if ( NA ) stop("This is silly")
#  Error in if (NA) stop("This is silly") : 
#    missing value where TRUE/FALSE needed

My guess (and it's an utter guess at this stage without further testing) is to try adding stringsAsFactors=FALSE to your read.table() command.

Himyarite answered 4/5, 2015 at 10:8 Comment(3)
Adding stringsAsFactors=FALSE didn't help...All variables are of int type.Heng
@Heng In bbatch(n, as.integer(BATCHBYTES/theobytes)) : NAs introduced by coercion tells me that something, somewhere is not of integer or numerical type. I suggest looking at what exactly BATCHBYTES and theobytes are.Copywriter
I read that BATCHBYTES and theobytes are related to the 'ffdfdply' package that is used by 'tabplot' package but I don't see how can I change themHeng

© 2022 - 2024 — McMap. All rights reserved.