简体   繁体   中英

Unknown item label in R

rules <- apriori(Day.4,parameter = list(minlen=2, supp=0.005, conf=0.8), appearance = list(rhs=c("Status=D", "Status=G"), default="lhs"), control = list(verbose=F))
rules.sorted <- sort(rules, by="lift")
inspect(rules.sorted)

I am trying to run this code, and it shows an error.

Error in asMethod(object) : Status=D is an unknown item label, Status=G is an unknown item label.

What seems to be the problem? I am kind of new to R as well.

So any detailed help would be appreciated!

The error message says that the items Status=D and Status=G do not exist in your data. Create a transaction set first using

 trans <- as(Day.4, "transactions")
 summary(trans)
 itemLabels(trans)

Once you have the actual item names then you can use trans in the call for apriori .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM