Skip to content

Instantly share code, notes, and snippets.

@Buntix
Last active August 29, 2015 14:10
Show Gist options
  • Save Buntix/e60b88be7a344f64dd79 to your computer and use it in GitHub Desktop.
Save Buntix/e60b88be7a344f64dd79 to your computer and use it in GitHub Desktop.
noises.stack <- na.omit(stack(read.csv('Pilot_Transpose_arules test.csv', header=FALSE)))
noises.stack$syllables <- 1
noises.stack$time <- cumsum(noises.stack$syllables)
noises.stack <- noises.stack[,c('ind', 'time', 'syllables', 'values')]
# convert cols to factors and then change the dataframe into a transactions class object
noises.col_names <- names(noises.stack)
noises.stack[,noises.col_names] <- lapply(noises.stack[,noises.col_names], factor)
noises.tran <- as(noises.stack, 'transactions')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment