How about computing the 'lhs' of the rules once and then using that
information for the subsets.
On Wed, Jul 16, 2008 at 11:56 AM, Daniel Wagner <danieljm1976 at
yahoo.com> wrote:> Dear R experts,
>
> I need help to make my little program efficient which now takes 2hrs to
complete.
>
> Using arules package I developed set of rules consisted of 900 rules. Now I
want to check whether a lower rule is a subset of a higher premises rule. And if
it is a subset of higher premises rule then drop this rule. I am using following
code but it takes too much time.
>
>
> nor<-length(rules)
> k<-rep(T, nor)
> for(i in 1:(nor-1)){
> for(j in (i+1):nor){
> if((is.subset(lhs(rules[i]),lhs(rules[j])) &
is.subset(rhs(rules[i]), rhs(rules[j])))==T){
> k[i]<-F
> break
> }
> }
> }
>
> Could somebody help me.
>
> Thanks
>
> Daniel
> Amsterdam
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?