What is the use of cols parameter in read.transactions( cols=c(1,2)) function


#1

can anyone please explain, what is the use of cols = c(1,2) parameter in the function given below.

groceries = read.transactions( file= 'groceries.csv', format= 'single' , cols=c(1,2)) function


#2

I'm not really familiar with arules (the package that contains the read.transactions() function), but, from the documentation (since the format parameter is set to 'single' in your example):

For the 'single' format, cols is a numeric or character vector of length two giving the numbers or names of the columns (fields) with the transaction and item ids, respectively.

So, it sounds like column 1 contains the transactions, and column two contains the item ids. They need to be specified so that the input data can be turned into transactions-class.


#3

Thanks for the answer.