check the help file.  ?aggregate says that it ignores missing values by
default  ;)


df <- read.table(  header = TRUE , text = "FID  MID     IID         EW_INCU
EW_17.5   EMW        EEratio
1   4621  TWF2H5    45.26        NA             15.61         NA
1   4621  TWF2H6    48.02        44.09         13.41      0.3041506
2   4630  TWF2H19   51.44       47.81         NA             NA
2   4631  TWF2H21   NA          52.72         16.70      0.3167678
2   4632  TWF2H22   55.70       50.45         16.48      0.3266601
2   4633  TWF2H23   44.42       40.89         12.96      0.3169479"
)

aggregate( . ~ FID , data = df , mean )


# na.rm would need to be passed to tapply, which is a similar function
tapply( df[ , 4 ] , df[ , 1 ] , mean )
tapply( df[ , 4 ] , df[ , 1 ] , mean , na.rm = TRUE )

	[[alternative HTML version deleted]]


