Skip to content
Prev 170321 / 398506 Next

Extending each element in a list, or rbind()-ing arrays of different length without recycling

On 13/02/2009, at 9:06 AM, markleeds at verizon.net wrote:

            
Pretty easy:

na.at.end <- function(x){
i <- is.na(x)
c(x[!i],rep(NA,sum(i)))
}
Then just change to:

t(apply(mat,1, function(.row) {
    .row[duplicated(.row)] <- NA
    na.at.end(.row)
}))

	cheers,

		Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}