double_count: Identifies seizures with different countries of origin for...

Description Usage Arguments Details Value See Also Examples

View source: R/double_count.R

Description

This is needed when calculating weights out. The countries of origin for seizures containing both raw and worked ivory may be different. For example the raw ivory may come from country A and worked ivory from country B. Hence the raw RIE weight needs to be removed for country B's total weight out and the worked RIE weight needs to be removed from country A's total weight out. This function interacts with the ETIS database and the seizures stored in df.1 created by df_quantities_RIE_separate.fn to identify all seizures with a countrt of origin. It then identifies which seizures have different countries of origin for raw and worked ivory

Usage

1
2
double_count(year.from = year.from, year.to = year.to,
  statusMin = statusMin, df.RIE = df.1)

Arguments

year.from

Starting year

year.to

Ending year

statusMin

Minimum status of seizure record to include in summary (usually 3)

df.1

Dataframe with list of seizure records to be considered. Created using df_quantities_RIE_separate.fn

Details

The main use of this function is to contribute to the calculation of two new database tables for law enforcement ratio and trade flow accounting.

Value

A list with two items. Each item is a dataframe with information about the seizures for which there are different countries of raw and worked origin. double.raw a dataframe for countries that were not a country of raw origin but were a country of worked origin double.raw a dataframe for countries that were not a country of worked origin but were a country of raw origin Each dataframe has two columns (a) An identifying column of two parts separated by a colon giving seizure id:country code (eg 12345:999) (b) worked or raw weight that should not be attributed to that country for that seizure

For example for double.wkd the dataframe might look like the following:

seizure_wkd raw
54321:999 123.45

For seizure 54321 country 999 was a country of worked origin but was not a country of raw origin. Therefore 123.45 kg (the weight of the raw ivory for that seizure) must be removed from the total weight out attributed to this country

See Also

df_quantities_RIE_separate, mult_ctries, inout_tables_LE_TF_prep, inout_tables_LE_TF_final

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
year.from <- 1900
year.to <- 2100
statusMin <- 3

df.1 <- df_quantities_RIE_separate(year.from = year.from, year.to = year.to,
statusMin = statusMin, reg.model = 'wt est.Rdata')

double.recs <- double_count(year.from = year.from, year.to = year.to,
statusMin = statusMin, df.RIE = df.1)
#_______________________________________________________________________

fmunderwood/ETISdbase documentation built on Feb. 29, 2020, 12:46 a.m.