Description Usage Arguments Value Author(s) See Also Examples
A matrix may contain separate data areas. This function will fetch the upper
left one as the core area, retaining the original row index and column index.
It is usually used after getMsoChartSourceData
.
1 2 3 | getCoreDataMtx(mtx, gapWidth = 2, emptyString = c(NA, NaN))
get_core_matrix(mtx, gapWidth = 2, emptyString = c(NA, NaN))
|
mtx |
the raw matrix to process. |
gapWidth |
numeric, width of the "gap" rows or columns. Default 2. |
emptyString |
character vector, how to define the "gap".
Default |
A shrinked matrix
Yiying Wang, wangy@aetna.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## Not run:
## The source matrix
m <- matrix(c(NA, NA, NA, NA, NA, NA,
NA, 0, 0, NA, NA, 0,
NA, 1, 2, NA, NA, NA,
NA, NA, NA, NA, NA, NA), byrow=TRUE, ncol=6)
## There are two areas, with a gap of 2 columns
getCoreDataMtx(m, gapWidth=2) # yields the left upper 2*2 matrix
2 3
2 0 0
3 1 2
## If the gapWidth is larger than 2, then the gap will be included in
## the data area
getCoreDataMtx(m, gapWidth=3) # yields:
2 3 4 5 6
2 0 0 NA NA 0
3 1 2 NA NA NA
## If we include 0 in emptyString, then
getCoreDataMtx(m, gapWidth=2, emptyString=c(NA, NaN, 0)) # yields
2 3
3 1 2
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.