I have an excel file with 7 columns. The first three are numerical and columns 4-7 are categorical. I saved this into a txt file and loaded it into R (using RStudio, clicking the "import dataset" button in the environment) which launched the following command
data <- read.table("~/csectiondata.txt", quote="\"", comment.char="")*
Now, i have been trying to use apriori(data) and this is the error i get:
Error in asMethod(object) : column(s) 1, 2, 3 not logical or a factor. Use as.factor, as.logical or categorize first.
I read that using sapply and as.factor would help, so i did this:
data <- sapply(data, as.factor)*
but now i'm getting this error:
Error in t(as(from, "ngCMatrix")) : error in evaluating the argument 'x' in selecting a method for function 't': Error in asMethod(object) : cannot coerce 'NA's to "nsparseMatrix"
I've tried transaction_data <- as(data, "transactions")
as well and i'm getting the same.
"Error in asMethod(object)"
I'm totally lost. can someone help me out?
dput(head(data))
. It is much easier to help if we can track down the problem ourselves – jeremycg