Re: [R] Add rows to dataframe by split values

2014-02-20 Thread arun
Hi, Try: library(stringr) res <- transform(dat[rep(1:nrow(dat),str_count(dat$Result,"-")+1),],Result=unlist(strsplit(as.character(dat$Result)," - ")),Batch=ave(Batch,Batch,FUN=function(x) paste0(x,letters[seq_along(x)])))  row.names(res) <- 1:nrow(res) # Based on the expected results, it coul

Re: [R] Add rows to dataframe by split values

2014-02-20 Thread jayesh.baviskar
Hello Bart, I solved your problem. Please find the code given below, dat <-structure(list(Batch = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L), Test =