sumup: Sum the data up into higher level groups

Description Usage Arguments Details Value See Also Examples

Description

Aggregates the data into higher level groups by calculating the sum of all the numeric data columns by group

Usage

1
sumup(data, sumby, drop = NA)

Arguments

data

a data frame with ncol(data) >= 2. Each row of the data represents a neighbourhood or some other areal unit for which counts of population have been made.

sumby

a character or numeric vector of length 1 identifying either the name or columns position of the variables in data that records the higher-level group into which the data will be aggregated (summed)

drop

a character or numeric vector identifying any variables to be dropped from the aggregated data, such as lower-level names and identifiers

Details

Sometimes a population group is too few in number sensibly to be analysed at the smallest area scale. An indication of this is when the expected value under randomisation of the index of dissimilarity is a large fraction of the observed value. In this case, the data can be aggregated into higher level units, summing the population counts. Aggregating the data also can be used to explore how the index changes with the scale of analysis.

Value

a data frame containing the aggregated data

See Also

id

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
data(ethnicities)
head(ethnicities)
id(ethnicities, vars = c("Arab","Other","Persons"), expected = TRUE)
# the expected value is very high relative to the ID
aggdata <- sumup(ethnicities, sumby = "LSOA", drop = "OA")
head(aggdata)
id(aggdata, vars=c("Arab","Other","Persons"), expected = TRUE)
# Note the sensitivity of the ID to the scale of analysis

## End(Not run)
data(aggdata)
head(aggdata)
moreagg <- sumup(ethnicities, sumby = "MSOA", drop = "LSOA")
head(moreagg)

MLID documentation built on May 2, 2019, 11:05 a.m.