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

mql4beginner
  • 2,193
  • 5
  • 34
  • 73

2 Answers2

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

Matt
  • 490
  • 8
  • 19
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.

Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
  • Adding stringsAsFactors=FALSE didn't help...All variables are of int type. – mql4beginner May 04 '15 at 11:00
  • @mql4beginner `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. – Simon O'Hanlon May 04 '15 at 11:03
  • 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 them – mql4beginner May 04 '15 at 11:12