Dear R-users,

I'd be very greatful if you could help me with the following as after a few tests I haven't still been able to get the right outcome.

I've got this data:
dd_1 <- data.frame(ID = c("1","2", "3", "4", "5"),
                 Class_a = c("a",NA, "a", NA, NA),
                 Class_b = c(NA, "b", "b", "b", "b"))

And I'd like to produce a new column 'CLASS':
dd_2 <- data.frame(ID = c("1","2", "3", "4", "5"),
                 Class_a = c("a",NA, "a", NA, NA),
                 Class_b = c(NA, "b", "b", "b", "b"),
                 CLASS = c("a", "b", "a-b", "b", "b"))

Thanks a lot!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to