Aggregate data according to the specification in tbl_Filgruppe
in AGGREGERE column. The input in argument source must be a lower
granularity level than the level input.
Arguments
- dt
Input data preferrably in a
data.tableformat but is not mandatory- source
What geographical granularity codes that is available in the source data. This will be used for merging with the geo codebook generated from
geo_map()ie. fromtblGeoin geo database- level
Geographical granularity for aggregating data. See
getOption("orgdata.geo.levels")- year
Which year the geograhical codes to be recoded to. If it is empty then global option for
orgdata.yearwill be used.- aggregate.col
Other columns to aggregate other than the standard ie.
UTDANN,LANDSSB,LANDBAKandINNVKAT- geoDT
Geo codes to aggregate dataset with
- check
If TRUE then output will keep variables for geographical levels without aggregating it. This is useful to check for geographical codes that are missing. Else use
options(orgdata.aggregate = FALSE)- base
Logical value. If
TRUEthen use year in the original data as the base year to recode the geographical codes. Default isFALSEand use all available codes in geo codebook- control
Logical value.
TRUEif the file has been controlled for possible errors- wide
Column(s) from reshape wide
See also
Other aggregate functions:
get_aggregate()
Examples
if (FALSE) { # \dontrun{
# To aggregate source data with enumeration area codes ie. grunnkrets, to
# manucipaltiy ie. kommune
dt <- make_file("BEFOLKNING")
DT <- do_aggregate(dt, source = "grunnkrets", level = "kommune")
} # }
