R/items.R

Defines functions items

Documented in items

#' Extracts items in the left-hand-side of an association rule.
#'
#' The function is used in the elaboration of the left-hand-side of
#' association rules to search for the items.
#'
#' @param itemset object of class rules.
#' @return A string vector with the items in the left-hand-side
#' of the rule in itemset.
#' @export
#' @import stringr
#'
#' @examples
#' items('{TAF1=1,EP300=1,MAX=1}')
#' # the output is: 'TAF1=1','EP300=1','MAX=1'

items <- function(itemset) {
    items.0 <- gsub("[:{:]", "", itemset)
    items.1 <- gsub("[:}:]", "", items.0)
    items <- strsplit(items.1, ",")
    return(items[[1]])
}

Try the TFARM package in your browser

Any scripts or data that you put into this service are public.

TFARM documentation built on Nov. 8, 2020, 7:01 p.m.