


Dear all, there is a best way to do the following task?
 
x               = rep(c("A","B"),5)
y               =  rnorm(10)
data           = data.frame(x,y)
data$y[1:2]   = c(NA,NA)
means         = ave(data$y,as.character(data$x),FUN=function(x)mean(x,na.rm=T))
aux           = which(is.na(data$y))
data[aux,"y"] = means[aux]
_________________________________________________________________
Encontre o que procura com mais eficięncia! Instale já a Barra de Ferra[[replacing trailing spam]]

	[[alternative HTML version deleted]]

