R `summary` when not all cells have data -


is there argument in summary (or command) force r calculate values when there "no data" in every cell?

in questionnaire subjects did not provide information; , cells entered -nodata-. cells answer not applicable (based on previous question in q.) entered -1. summary looks this:

> summary(qs$esc)        -1 -nodata-      0.5        1       12       15        3        49        3        1        1        1        1        1  

what want calculated summary. there way tell r disregard -nodata- , -1?

i don't understand kind of summary want compute.

if use na instead of "-nodata-" , "-1" codes, automatically taken account when using summary function :

for example :

r> v <- c(na, na, 0.5, 1, 12, 15, 3) r> summary(v)    min. 1st qu.  median    mean 3rd qu.    max.    na's      0.5     1.0     3.0     6.3    12.0    15.0     2.0  r> table(v) v 0.5   1   3  12  15    1   1   1   1   1  

you can see here v considered numeric, there no string value in it. when introduce "-nodata-" value treated either character or factor variable.

you can use exclude argument of table function automatically ignore values :

r> v <- c(-1, "-nodata-", 0.5, 1, 12, 15, 3) r> table(v) v      0.5        1       -1       12       15        3 -nodata-         1        1        1        1        1        1        1  r> table(v, exclude=c(-1, "-nodata-")) v 0.5   1  12  15   3    1   1   1   1   1  

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -