Data Style:
group value
A 1
A 2
A 3
B 5
B 6
C 7
Code:
library(readxl)
library(arules)
DF <- read_xlsx ( 'E: /data.xlsx',sheet = "Sheet1")
df_1 <- AS (Split (Group DF $, $ DF value), "Transactions")
# converted to data frame type
df_2 <- as (df_1, "data.frame")
# removed braces
Library (stringr)
df_2 $ items <- str_sub (df_2 $ items, 2L = Start, End = str_length (df_2 items $) -. 1)
The results style:
group value
A 1,2,3
B 5,6
C 7