[R] Making an aggregated factor variable from an existing one

Antti Simola asimola78 at gmail.com
Thu Jan 17 14:20:31 CET 2013


This is quite simple data manipulation task and I need help for it. I 
want to make new factor variable that is an aggregation of an existing 

This works as I intended:

X[Y == "original label"] <- " new label"

How to make following work then (to make coding more convenient):

original.labels <- c("ol.1","ol.2","ol.3")

X[Y == original.labels] <- "new label"



More information about the R-help mailing list