View source: R/Apriori.Basket.R
Apriori.Basket | R Documentation |
Convert vector or dataframe to sparse matrix.
Apriori.Basket(x, sep = ";", dup.delete = FALSE)
x |
a vector |
sep |
one separator |
dup.delete |
whether to delete duplicated values in the same row, default is FALSE |
a sparse matrix
# convert a vector to sparse matrix
g=c('a,b,a,,','a,b,c,d','d,c,f,g,h')
Apriori.Basket(x=g,sep = ',')
# convert a dataframe to sparse matrix
library(data.table)
df=fread(text = '
t1 t2 t3
a NA d
g a j')
Apriori.Basket(x=df,sep = ',')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.