Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. R `summary` when not all cells have data
  2. > summary(qs$ESC)
  3.       -1 -nodata-      0.5        1       12       15        3
  4.       49        3        1        1        1        1        1
  5.        
  6. R> v <- c(NA, NA, 0.5, 1, 12, 15, 3)
  7. R> summary(v)
  8.    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
  9.     0.5     1.0     3.0     6.3    12.0    15.0     2.0
  10. R> table(v)
  11. v
  12. 0.5   1   3  12  15
  13.   1   1   1   1   1
  14.        
  15. R> v <- c(-1, "-nodata-", 0.5, 1, 12, 15, 3)
  16. R> table(v)
  17. v
  18.      0.5        1       -1       12       15        3 -nodata-
  19.        1        1        1        1        1        1        1
  20. R> table(v, exclude=c(-1, "-nodata-"))
  21. v
  22. 0.5   1  12  15   3
  23.   1   1   1   1   1
  24.        
  25. qs$ESC[qs$ESC == "-nodata-"] <- NA
  26. summary(as.numeric(levels(qs$ESC))[qs$ESC]