Skip to content

Double condition

3 messages · zuzana zajkova, Rui Barradas

#
Hello,

I believe the following solves your problem. It's a bit more complicated 
but with the sample dataset you've provided the result is as wished.



tmp <- lapply(split(subz, subz$time), function(x) {
	i1 <- which(as.character(x$fix) == "noon")[1]
	i2 <- which(as.character(x$fix) == "midnight")
	x$day[i2] <- x$day[i1]
	x})
names(tmp) <- NULL
result <- do.call(rbind, tmp)


Hope this helps,

Rui Barradas

Em 25-03-2013 14:15, zuzana zajkova escreveu: