merge | R Documentation |
Provides the generic function merge()
and the methods for itemMatrix
and transactions to add new items to existing data.
merge(x, y, ...)
## S4 method for signature 'itemMatrix'
merge(x, y, ...)
## S4 method for signature 'transactions'
merge(x, y, ...)
x |
an object of class itemMatrix or transactions. |
y |
an object of the same class as |
... |
further arguments; unused. |
Returns a new object of the same class as x
with the items in y
added.
Michael Hahsler
Other preprocessing:
discretize()
,
hierarchy
,
itemCoding
,
sample()
Other itemMatrix and transactions functions:
abbreviate()
,
c()
,
crossTable()
,
duplicated()
,
extract
,
hierarchy
,
image()
,
inspect()
,
is.superset()
,
itemFrequency()
,
itemFrequencyPlot()
,
itemMatrix-class
,
match()
,
random.transactions()
,
sample()
,
sets
,
size()
,
supportingTransactions()
,
tidLists-class
,
transactions-class
,
unique()
data("Groceries")
## create a random item as a matrix
randomItem <- sample(c(TRUE, FALSE), size = length(Groceries),replace = TRUE)
randomItem <- as.matrix(randomItem)
colnames(randomItem) <- "random item"
head(randomItem, 3)
## add the random item to Groceries
g2 <- merge(Groceries, randomItem)
nitems(Groceries)
nitems(g2)
inspect(head(g2, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.