Re: [R] To build a new Df from 2 Df

2014-10-14 Thread David.Kaethner
Hello, here's a draft of a solution. I hope it's not overly complicated. # find all possible combinations combi - expand.grid(Dem$Nom, Rap$Nom); names(combi) - c(Dem, Rap) # we need the corresponding departments and units combi$DemDep - apply(combi, 1, function(x) Dem$Departement[x[1] ==

Re: [R] seqinr ?: Splitting a factor name into several columns. Dealing with metabarcoding data.

2014-10-13 Thread David.Kaethner
I'm not sure I understood your problem, maybe like this: # split identifiers into columns df1 - data.frame(cbind(X = 1:10, Y = rnorm(10)), Z.identifierA.B1298712 = factor(rep(LETTERS[1:2], each = 5))) id - names(df1)[3] x - do.call(rbind, str_split(id, \\.)) y - sapply(x,