Re: [R] Relevel dynamically

2012-01-16 Thread mails
Hi Michael, yes you were right and your solution works great. thanks a lot. I managed to do it but with 4 lines of code rather than only 1. Cheers -- View this message in context: http://r.789695.n4.nabble.com/Relevel-dynamically-tp4299531p4300080.html Sent from the R help mailing list arch

Re: [R] Relevel dynamically

2012-01-16 Thread R. Michael Weylandt
If I understand you right: you have an "overall" order you want to always keep, but need to get only those elements that show up in your df while keeping them in the right order. I think this works: factor(df$name, levels = intersect(OVERALL, df$name)) Michael On Mon, Jan 16, 2012 at 8:53 AM, ma