discard_unusable drops observations that cannot be used with models that convert columns to log scale, and therefore requiere non-negative and finite observations.

Consider that some of the functions within this package will drop observations when required and it is not requiered to be run before fitting a model.

discard_unusable(data, columns)

Arguments

data

(Type: data.frame) the dataset to be used.

columns

The columns to be cleaned (e.g. c("flow", "distw")) in the case of ddm when used with the example dataset gravity_zeros)

Value

The function returns the summary of the estimated gravity model as an lm-object.

See also

Examples

discard_unusable(gravity_zeros, "flow")
#> # A tibble: 17,088 × 10
#>    iso_o iso_d  distw gdp_o   gdp_d   rta      flow contig comlang_off comcur
#>    <chr> <chr>  <dbl> <dbl>   <dbl> <dbl>     <dbl>  <dbl>       <dbl>  <dbl>
#>  1 AFG   ARG   15341. 8399. 214058.     0 0.061          0           0      0
#>  2 AFG   AUS   11086. 8399. 768178.     0 0.406          0           0      0
#>  3 AFG   AUT    4567. 8399. 322444.     0 0.165          0           0      0
#>  4 AFG   AZE    1822. 8399.  20122.     0 0.00160        0           0      0
#>  5 AFG   BEL    5332. 8399. 392001.     0 4.16           0           0      0
#>  6 AFG   BFA    7464. 8399.   6205.     0 0.00103        0           0      0
#>  7 AFG   BGD    2489. 8399.  61961.     0 3.02           0           0      0
#>  8 AFG   BGR    3819. 8399.  31483      0 0.0197         0           0      0
#>  9 AFG   BLR    3766. 8399.  36945.     0 1.43           0           0      0
#> 10 AFG   BOL   15101. 8399.  11163.     0 0.0000837      0           0      0
#> # ℹ 17,078 more rows
discard_unusable(gravity_zeros, c("flow", "distw"))
#> # A tibble: 17,088 × 10
#>    iso_o iso_d  distw gdp_o   gdp_d   rta      flow contig comlang_off comcur
#>    <chr> <chr>  <dbl> <dbl>   <dbl> <dbl>     <dbl>  <dbl>       <dbl>  <dbl>
#>  1 AFG   ARG   15341. 8399. 214058.     0 0.061          0           0      0
#>  2 AFG   AUS   11086. 8399. 768178.     0 0.406          0           0      0
#>  3 AFG   AUT    4567. 8399. 322444.     0 0.165          0           0      0
#>  4 AFG   AZE    1822. 8399.  20122.     0 0.00160        0           0      0
#>  5 AFG   BEL    5332. 8399. 392001.     0 4.16           0           0      0
#>  6 AFG   BFA    7464. 8399.   6205.     0 0.00103        0           0      0
#>  7 AFG   BGD    2489. 8399.  61961.     0 3.02           0           0      0
#>  8 AFG   BGR    3819. 8399.  31483      0 0.0197         0           0      0
#>  9 AFG   BLR    3766. 8399.  36945.     0 1.43           0           0      0
#> 10 AFG   BOL   15101. 8399.  11163.     0 0.0000837      0           0      0
#> # ℹ 17,078 more rows