HI,
I guess this should be a bit faster.
#1st case
dat1$V3 <- lapply(seq_along(dat1$V2),function(i) c(dat1$V2[[i]][-1] -
head(dat1$V1[[i]],-1), tail(dat1$V1[[i]],1)))
#2nd case
dat2$V3 <- unlist(lapply(seq_along(lst1[,2]),function(i)
paste(c(lst1[,2][[i]][-1] - head(lst1[,1][[i]], -1),
tail(l
Hi,
It is better to show the example data using ?dput(). Here, it is not clear
whether the columns are character columns or lists.
##If it is the latter case
dat1 <- data.frame(V1=I(list(1:3, c(1,2,4), c(2,3,4,5))), V2= I(list(c(3,6,5),
c(7,10,9), 2:5)))
dat1$V3 <- mapply(`c`,mapply(`-`, lapp
2 matches
Mail list logo