MyNixOS website logo
Description

Implementation of Flag Aggregation.

Three methods are implemented in R to facilitate the aggregations of flags in official statistics. From the underlying flags the highest in the hierarchy, the most frequent, or with the highest total weight is propagated to the flag(s) for EU or other aggregates. Below there are some reference documents for the topic: <https://sdmx.org/wp-content/uploads/CL_OBS_STATUS_v2_1.docx>, <https://sdmx.org/wp-content/uploads/CL_CONF_STATUS_1_2_2018.docx>, <http://ec.europa.eu/eurostat/data/database/information>, <http://www.oecd.org/sdd/33869551.pdf>, <https://sdmx.org/wp-content/uploads/CL_OBS_STATUS_implementation_20-10-2014.pdf>.

flagr

A simple R package to derive flag for aggregates

installation

> devtools::install_github("eurostat/flagr")

background

A flag is an attribute of a cell in a data set that provides additional qualitative information about the statistical value of that cell. They can indicate, for example, that a given value is estimated, confidential or represents a break in the time series.

Currently different sets of flags are in use in the European Statistical System (ESS). Some domains uses the SDMX code list for observation status and confidentiality status. Eurostat uses a simplified list of flags for dissemination, and other domains applies different sets of flags defined in regulations or in other agreements.

In most cases it is well defined how the flag shall be assigned to the individual values, but it is not straightforward what flag shall be propagated to an aggregated value like sum, average, quintiles, etc. For this reason this package (flagr) was created to help users assign a flag to the aggregate based on the underlying flags and values.

content

The package contains a fictive test data set(test_data), a wrapping function (propagate_flag) calling the different methods and 3 methods (flag_hierarchy, flag_frequency and flag_weighted) to derive flags for aggregates.

  • the flag_hierarchy method returns the flag which listed first in a given set of ordered flags,
  • the flag_frequency method returns the most frequent flag for the aggregate,
  • the flag_weighted method returns the flag which cumulative weight is the highest.

Detailed documentation of the functions is in the package or see the vignette for more information.

examples

> library(tidyr)
> flags <- spread(test_data[, c(1:3)], key = time, value = flags)
>
> \#hierarchy method
> propagate_flag(flags[, c(2:ncol(flags))],"hierarchy","puebscd")
> propagate_flag(flags[, c(2:ncol(flags))],"hierarchy",c("b","c","d","e","p","s","u"))
>
> \#frequency method
> propagate_flag(flags[, c(2:ncol(flags))],"frequency")
>
> \#weighted method
> flags<-flags[, c(2:ncol(flags))]
> weights <- spread(test_data[, c(1, 3:4)], key = time, value = values)
> weights<-weights[, c(2:ncol(weights))]
>
> propagate_flag(flags,"weighted",flag_weights=weights,threshold=0.1)
Metadata

Version

0.3.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows