
Untitled
By: a guest on
Jun 30th, 2012 | syntax:
None | size: 0.75 KB | hits: 13 | expires: Never
R `summary` when not all cells have data
> summary(qs$ESC)
-1 -nodata- 0.5 1 12 15 3
49 3 1 1 1 1 1
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
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
qs$ESC[qs$ESC == "-nodata-"] <- NA
summary(as.numeric(levels(qs$ESC))[qs$ESC]