getCoreDataMtx: Shrink the matrix to its core area

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

1
getCoreDataMtx(mtx, gapWidth = 2, emptyString = c(NA, NaN))

Arguments

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 c(NA, NaN)

Value

A shrinked matrix

Author(s)

Yiying Wang, wangy@aetna.com

See Also

getMsoChartSourceData

Examples

 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)

madlogos/aseshms documentation built on May 21, 2019, 11:03 a.m.