A more specific reproducible example.
set.seed(1023)
library(arules)
# starting from a dataframe whose fields are characters (see stringsAsFactors =
FALSE), as asked
products <- c("P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10")
mydf <- data.frame(user = sample(LETTERS[1:20], 100, re
mydf <- data.frame(d1 = LETTERS[1:10], d2 = letters[11:20])
> str(mydf)
'data.frame': 10 obs. of 2 variables:
$ d1: Factor w/ 10 levels "A","B","C","D",..: 1 2 3 4 5 6 7 8 9 10
$ d2: Factor w/ 10 levels "k","l","m","n",..: 1 2 3 4 5 6 7 8 9 10
>
library(arules)
trans1 <- as(mydf, "transaction
Running R backend MySQL - ran a query
<- Query
the resulting dataframe contains 2 columns and both are chars.
Need to change the dataframe class to transaction class
as I need to run Apriori algorithm
how to do that?
Thanks
Santanu
[[alternative HTML version deleted]]
__
3 matches
Mail list logo