问题
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
回答1:
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
回答2:
The problem lies in the command bbatch(n, as.integer(BATCHBYTES/theobytes))
. Whatever you are doing is causing NA
s 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.
来源:https://stackoverflow.com/questions/30027316/what-is-the-meaning-of-this-error-error-in-if-anyb-1-stopb-too-small