Saturday 15 May 2010

R: Extract non-NA elements from a matrix and return with row/column labels -



R: Extract non-NA elements from a matrix and return with row/column labels -

i have big matrix result of using tapply index argument of 2 rows dataframe. of matrix empty (na).

here how used tapply: latavgs <- tapply(geodata$latitude,geodata[5:6],fun=mean) latavgs resulting matrix, , geodata dataframe mentioned above.

is there way extract non-na elements latavgs , homecoming them in such way have row , column listed, value? or there improve way utilize tapply i've done, if want take means of values in geodata belong each unique pair of values geodata[5:6]? i.e., each unique pair in geodata[5:6] 1 mean.

thanks help.

really hard solve without @ data. seek this: why tapply take subset na , not exclude them totally

matrix extract tapply

No comments:

Post a Comment