inbo / movepub

R package to prepare animal tracking data from Movebank for publication in a research repository, GBIF or OBIS
https://inbo.github.io/movepub/
Other
3 stars 1 forks source link

Use dplyr for write_dwc() #63

Closed sannegovaert closed 6 months ago

sannegovaert commented 7 months ago

Fixing #61

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.60%. Comparing base (9279121) to head (936a361).

:exclamation: Current head 936a361 differs from pull request most recent head fe5d32e. Consider uploading reports for the commit fe5d32e to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #63 +/- ## ========================================== + Coverage 78.07% 85.60% +7.52% ========================================== Files 6 6 Lines 260 396 +136 ========================================== + Hits 203 339 +136 Misses 57 57 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

PietrH commented 7 months ago

Does this help Sanne?

str_replace_na <- function(string, replacement = ""){
  string[is.na(string)] <- replacement
  return(string)
}

c("a", NA, "c") |> str_replace_na(replacement = "") |> paste0(collapse = " ")
#> [1] "a  c"
sannegovaert commented 7 months ago

Does this help Sanne?

str_replace_na <- function(string, replacement = ""){
  string[is.na(string)] <- replacement
  return(string)
}

c("a", NA, "c") |> str_replace_na(replacement = "") |> paste0(collapse = " ")
#> [1] "a  c"

I don't think it would fix the problem in this case. It was using coalesce() and paste() together that didn't work.

So I solved it differenlty, thought less elegantly, with ifelse() and is.na().

sannegovaert commented 7 months ago

I fixed the requested changes :-)