[R] "Negative length vectors are not allowed" error

Martin Maechler maechler at stat.math.ethz.ch
Tue Jan 20 10:30:34 CET 2015


> Hi all, I have a question concerning an error that occurs when using the inspect() function on a set of rules made by the apriori function from the arules package. I have a dataset with 12 million records. It contains some basic sales information (such as product, customer data). I want to use the apriori function from the arules package on it: ruleset <- apriori(sales, parameter=list(support=0.0005, confidence=0.1, minlen=2))It gives me 780379 rules. I want to have that much rules on purpose, so hence the parameters being so low (I guess you can reproduce this problem with any large dataset and low settings for support and confidence). But then I want to check out the rules with inspect. It has a subset because I'm only interested in rules with the attribute Product in the rhs. inspect(subset(ruleset, subset=rhs %pin% "Product="))Then this error occurs: Error in inspect(subset(sales3ruleset, subset = rhs %pin% "Product=")) : 
>   error in evaluating the argument 'x' in selecting a method for function 'inspect': Error in .Call("R_or_ngCMatrix", x at data, y at data, PACKAGE = "arules") : 
>   negative length vectors are not allowedI looked around and apparently that part about "negative length vectors are not allowed" means that you want to create a vector that is larger than 2^31. How can you get around this limit? Or how can I make the inspectfunction work in this case?Thanks in advance!Kim  		 	   		  
Dear Kim,

if you learned to post (i.e. write that e-mail) in plain text,
the above would look more humane..

Still, I was able to decipher it and you are right in that
you hit a limitation of the current setup which may well
be linked to the Matrix package which I maintain, and on which
'arules' depends.

Can you please try to find a reproducible example [with randomly
generated data; i.e., you'd use  set.seed(),  runif(), rpois(),
rmultinom(), rnorm(),  ...] so we,
the maintainer of 'arules' Michael Hahsler (BCC'ed: use 
maintainer("arules") to find such an e-mail address),
and myself can look if and how that limitation might be lifted.

Best regards,
Martin Maechler, ETH Zurich



More information about the R-help mailing list