Skip to content
Back to formatted view

Raw Message

Message-ID: <4B03AF48.9010105@gmx.de>
Date: 2009-11-18T08:24:40Z
From: Andreas Wittmann
Subject: recode according to old levels

Dear R-users,

i try to recode a factor according to old levels

F <- factor(sample(c(rep("A", 4), rep("B",2), rep("C",5))))

recode(F, "levels(F)[c(1,3)]='X'; else='Y'")

i tried to work with eval or expression around levels(F)[c(1,3)], but 
nothing seems to work.


Many thanks if anyone could tell me what i've missed and what's the 
problem here.

best regards

Andreas