my objective is to apply association rules for text mining.
i have this sample of strings:
sample.word = c("abstracting","abstracting workflow","access control","access information","access methods","access patterns","access permissions","access to government information","accountability","acetamides")
than i make a matrix with all values 0
incidence.matrix_sample <- matrix(0, nrow=5, ncol=length(sample.word))
i add strings as matrix column
colnames(incidence.matrix_sample) <- sample.word
now i put 1 value in the column of terms that appear in document using pmatch function (documents.ids[[i]] is a vector with id of document)
for(i in 1:(dim(incidence.matrix_sample)[1]))
{
incidence.matrix_sample[i, pmatch(documents.ids[[i]], sample.word)] <- 1
}
i try to go on and transform my matrix first as itemMatrix and then as transactions (with as(my.matrix, "transactions") function) but when i try to inspect rules i get the same error:
incidence.matrix_sample <- as(incidence.matrix_sample, "itemMatrix")
incidence.matrix_sample <- as(incidence.matrix_sample, "transactions")
inspect(incidence.matrix_sample)
the result is:
Errore in UseMethod("inspect", x) :
no applicable method for 'inspect' applied to an object of class "c('matrix', 'double', 'numeric')"
and the same problems using apriori function to incidence.matrix_sample
Errore in UseMethod("inspect", x) :
no applicable method for 'inspect' applied to an object of class "c('rules', 'associations')"
are days that i'm trying to understand where is the problem.. can someone help me?