luomus / finbif
Showing 1 of 6 files from the diff.

@@ -33,6 +33,11 @@
Loading
33 33
#'   `{tidyr}` packages are available.
34 34
#' @param type_convert_facts Logical. Should facts be converted from character
35 35
#'   to numeric or integer data where applicable?
36 +
#' @param drop_na_facts Logical. Should missing or "all `NA`" facts be dropped?
37 +
#'   Any value other than a length one logical vector with the value of TRUE
38 +
#'   will be interpreted as FALSE. Argument is ignored if `drop_na` is TRUE for
39 +
#'   all variables explicitly or via recycling. To only drop some
40 +
#'   missing/`NA`-data facts use `drop_na` argument.
36 41
#' @inheritParams finbif_records
37 42
#' @inheritParams finbif_occurrence
38 43
#' @return A `data.frame`, or if `count_only =  TRUE` an integer.
@@ -53,7 +58,8 @@
Loading
53 58
  file, select, n = -1, count_only = FALSE, quiet = FALSE,
54 59
  cache = getOption("finbif_use_cache"), dwc = FALSE, date_time_method,
55 60
  tzone = getOption("finbif_tz"), write_file = tempfile(), dt, keep_tsv = FALSE,
56 -
  facts = list(), type_convert_facts = TRUE, drop_na = FALSE
61 +
  facts = list(), type_convert_facts = TRUE, drop_na = FALSE,
62 +
  drop_na_facts = drop_na
57 63
) {
58 64
59 65
  file <- preprocess_data_file(file)
@@ -191,7 +197,8 @@
Loading
191 197
    )
192 198
193 199
    facts_df <- spread_facts(
194 -
      facts_df, facts[[fact_type]], fact_type, id, type_convert_facts
200 +
      facts_df, facts[[fact_type]], fact_type, id, type_convert_facts,
201 +
      drop_na_facts
195 202
    )
196 203
197 204
    select[["user"]] <- c(
@@ -783,7 +790,9 @@
Loading
783 790
}
784 791
785 792
#' @noRd
786 -
spread_facts <-  function(facts, select, type, id, type_convert_facts) {
793 +
spread_facts <-  function(
794 +
  facts, select, type, id, type_convert_facts, drop_na_facts
795 +
) {
787 796
788 797
  missing_facts <- character()
789 798
@@ -802,6 +811,8 @@
Loading
802 811
      " - could not be found in dataset", call. = FALSE
803 812
    )
804 813
814 +
    missing_facts <- missing_facts[!isTRUE(drop_na_facts)]
815 +
805 816
  }
806 817
807 818
  if (!all(is.na(ind))) {
Files Coverage
R 100.00%
Project Totals (19 files) 100.00%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading