rtGetFromGrid: to access population data from the grid of [x,y,sex,age]

Description Usage Arguments Value Examples

Description

NOT USED YET. I might not even need it. rtGetFromRecord() likely to be more useful. rtGetFromGrid allows access to population data from a grid of sexes and ages. You can specify which [x,y,sex,age] you want to get data for. Each variable defaults to 'all' so rtGetFromGrid(aGrid) would return the whole grid. ='sum' can be used to sum across dimensions, thus rtGetFromGrid(aGrid,x='sum',y='sum',sex='sum',age='sum') would produce a single value of the total population on the grid.

Usage

1
rtGetFromGrid(aGrid, y = "all", x = "all", sex = "all", age = "all")

Arguments

aGrid

an array with the age distributions of males & females [y,x,sex,age]

y

grid row number

x

grid column number

sex

'all' returns both sexes separately,'M','F', 'sum' sums sexes

age

'all' returns age distribution, 'sum' sums all ages, or an integer age ?or maybe an age range too

Value

an array, matrix or vector named with remaining dimensions of [y,x,sex,age]

Examples

1
2
3
4
5
6
7
8
tst <- rt_runGrid()
aGrid <- tst['day2',,,,]
rtGetFromGrid(aGrid,x='sum',y='sum',sex='sum') #age structure for whole pop
rtGetFromGrid(aGrid,x='sum',y='sum',age='sum') #sex ratio for whole pop
#slight anomally this gives 4 grids
rtGetFromGrid(aGrid,x='all',y='all',age=c(1,2),sex='all')
#this gives just 1
rtGetFromGrid(aGrid,x='all',y='all',age=c(1,2),sex='sum')

AndySouth/rtsetse documentation built on May 5, 2019, 6:02 a.m.