T
T
tr1ck12016-05-20 21:10:59
data mining
tr1ck1, 2016-05-20 21:10:59

How to link multiple purchases to one person in RStudio?

There is a .csv file with transactions (individual number of one purchase / day / product / quantity), I enter it in RStudio, but when processing, for example, using arules, I can’t figure out how to separate all columns in order to filter by certain indicators (frequency purchases on a certain day, which product is bought more often, which product is bought with what more often, and so on). I am now solving this issue by splitting the file (for example, copying the column with days into a separate file) and analyzing which day people buy more often. But I would like to understand how to do this without pulling everything out of the file, because it is impossible to determine a lot from one column, because it needs to be linked to another.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexnss, 2017-05-09
@alexnss

I recommend studying the documentation for the data.table package, there is aggregation by groups and other transformations, pay special attention to the dcast, merge , := functions,
as usual in R, filtering of observations occurs inside square brackets
data[field1>42,]
Example of adding aggregating
data fields [,':='(sum=sum(money), avg=mean(money)), by=c('shop', 'date')]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question