Hello, If I have a dataframe:
example(data.frame) zz<-c("aa_bb","bb_cc","cc_dd","dd_ee","ee_ff","ff_gg","gg_hh","ii_jj","jj_kk","kk_ll") ddd <- cbind(dd, group = zz) and I want to divide the column named group by the "_", how would I do this? so instead of the first row being x y fac char group 1 1 C a aa_bb it should be: x y fac char group_a group_b 1 1 C a aa bb I know for a vector I can: x1 <- c("a_b","b_c","c_d") do.call("rbind",strsplit(x1, "_")) but I am not sure how this relates to my data.frame Thanks, Daisy -- Daisy Englert Duursma Room E8C156 Dept. Biological Sciences Macquarie University NSW 2109 Australia ______________________________________________ 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.