GroupAsList: Convert an grouping from EBX5 to a list

Description Usage Arguments Value Author(s) See Also Examples

View source: R/util_GroupAsList.R

Description

This function will merge the child ID's belonging to a single parent ID

Usage

1

Arguments

grouping

a grouping in the format (int=parent, int=child), as returned by EBX5

Value

grouping in the format int=parent list=(child1,child2, child3...)

Author(s)

Thomas Berger, thomas.berger@fao.org

See Also

ReadEBXGroup.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
df <- data.frame(group=c(100,100, 200, 200), children=c(10,11,21,22))
str(GroupAsList(df))
 $ grouping[, 1]: num  100 200
 $ children     :List of 2
   ..$ : num  10 11
   ..$ : num  21 22

library(faoebx5)
df <- ReadEBXGroup('HCL_FI_COUNTRY_CONTINENT_GEOREGION')
GroupAsList(df)

## End(Not run)

bergertom/fishstatr documentation built on Dec. 4, 2019, 2:08 p.m.