Dear Kim,

This seems to be an arules problem. More specifically in the subset function. I will investigate and fix this as soon as possible. You can use the following code in the meanwhile:

rr <- rhs(ruleset) %pin% "Product="
inspect(ruleset[rr])

Regards,
Michael

On 01/20/2015 04:55 AM, Kim C. wrote:
Additionally,  maybe it's interesting to note that I remember that I
first also tried the apriori function but with support =  0.001 (the
rest remains the same). It gave me the negative length vector error as
well but then I thought to update the packages and it seemed like it
worked because the inspect with subset gave the results. But with 0.0005
it still gives me that error.



Dear Martin,

Thanks for your fast reply. Sorry about the formatting of the previous
email. I actually tested it before sending and it came fine when sending
to my own account but when I send it to the r-help email address it
seemed like the formatting got lost.

I can actually send you the project of R I am working in because for
this experiment I am only using the Contoso DWH testdata from Microsoft.
The R project is too big to include in the attachment, so you can
download it from my dropbox via this link:
https://www.dropbox.com/s/lry1v7ka2env5xf/Example.RData?dl=0

I see I a made a small mistake in my description, so I will rewrite it
shortly in steps:
1. ruleset <- apriori(sales, parameter=list(support=0.0005,
confidence=0.1, minlen=2)) This gives 780379 rules.
2. inspect(subset(ruleset, subset=rhs %pin% "Product="))
3. just inspect(ruleset) does work. When finishing displaying  the
780379 rules, it also show me this message:
Warning message:
closing unused RODBC handle 1

If I understand the last part correctly, I should add Michael Hahsler's
email address to the BCC. Otherwise, my apologies.

Thanks again,

Kim

From: minorthre...@hotmail.com
To: maech...@stat.math.ethz.ch
Date: Tue, 20 Jan 2015 11:27:44 +0100
CC: r-help@r-project.org; mhahs...@lyle.smu.edu
Subject: Re: [R] "Negative length vectors are not allowed" error

<br>If the email is still unreadable, please look at the attachment email.txt.&nbsp;<br>Dear Martin,<br><br>Thanks for your fast reply. Sorry about the formatting of the 
previous email. I actually tested it before sending and it came fine when sending to my own account but when I send it to the r-help email address it seemed like the formatting got 
lost.&nbsp;<br><br>I can actually send you the project of R I am working in because for this experiment I am only using the Contoso DWH testdata from Microsoft.&nbsp;<br>The R 
project is too big to include in the attachment, so you can download it from my dropbox via this link:&nbsp;<br><a href="https://www.dropbox.com/s/lry1v7ka2env5xf/Example.RData?dl=0"; 
target="_blank">https://www.dropbox.com/s/lry1v7ka2env5xf/Example.RData?dl=0</a><br><br>I see I a made a small mistake in my description, so I will rewrite it shortly in 
steps:&nbsp;<br>1.&nbsp;ruleset &lt;- apriori(sales, parameter=list(support=0.0005, confidence=0.1, minlen=!
2)) This g
ives 780379 rules.&nbsp;<br>2.&nbsp;inspect(subset(ruleset, subset=rhs %pin% "Product="))<br>3. just inspect(ruleset) does work. When finishing displaying &nbsp;the 780379 rules, it also show me this and this message:&nbsp;<br>Warning 
message:<br>closing unused RODBC handle 1&nbsp;<br><br>If I understand the last part correctly, I should add Michael Hahsler's email address to the BCC. Otherwise, my apologies.&nbsp;<br><br>Thanks 
again,&nbsp;<br><br>Kim&nbsp;<br>----------------------------------------<br>&gt; From: maech...@stat.math.ethz.ch<br>&gt; Date: Tue, 20 Jan 2015 10:30:34 +0100<br>&gt; To: minorthre...@hotmail.com<br>&gt; CC: 
r-help@r-project.org; maech...@stat.math.ethz.ch<br>&gt; Subject: Re: [R] "Negative length vectors are not allowed" error<br>&gt;<br>&gt;<br>&gt; &gt; 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 millio!
n 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 
&lt;- 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=")) :<br>&gt; &gt; error in evaluating the argument 'x' in selecting a method for function 'inspect': Error in 
.Call("R_or_ngCMatrix", x@data, y@data, PACKAGE = "arules") :<br>&gt; &gt; negative length vectors are not allowedI 
looked around and apparently t!
hat part a
bout "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<br>&gt; Dear 
Kim,<br>&gt;<br>&gt; if you learned to post (i.e. write that e-mail) in plain text,<br>&gt; the above would look more humane..<br>&gt;<br>&gt; Still, I was able to decipher it and you are right in 
that<br>&gt; you hit a limitation of the current setup which may well<br>&gt; be linked to the Matrix package which I maintain, and on which<br>&gt; 'arules' depends.<br>&gt;<br>&gt; Can you please try to find 
a reproducible example [with randomly<br>&gt; generated data; i.e., you'd use set.seed(), runif(), rpois(),<br>&gt; rmultinom(), rnorm(), ...] so we,<br>&gt; the maintainer of 'arules' Michael Hahsler (BCC'ed: 
use<br>&gt; maintainer("arules") to find such an e-mail address),<br>&gt; and myself can look if and how that limitation might be lift!
ed.<br>&gt
;<br>&gt; Best regards,<br>&gt; Martin Maechler, ETH Zurich<br>                 
                      


______________________________________________ R-help@r-project.org
mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting
guide http://www.R-project.org/posting-guide.html and provide commented,
minimal, self-contained, reproducible code.

--
  Michael Hahsler, Assistant Professor
  Department of Engineering Management, Information, and Systems
  Department of Computer Science and Engineering (by courtesy)
  Bobby B. Lyle School of Engineering
  Southern Methodist University, Dallas, Texas

  office: Caruth Hall, suite 337, room 311
  email:  mhahs...@lyle.smu.edu
  web:    http://lyle.smu.edu/~mhahsler

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to