Skip to content

Commit

Permalink
fix: appending meta in edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-davison committed Dec 9, 2024
1 parent d8a630e commit 22ba291
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: openair
Title: Tools for the Analysis of Air Pollution Data
Version: 2.18.2.9004
Version: 2.18.2.9005
Date: 2024-10-01
Authors@R: c(
person("David", "Carslaw", , "[email protected]", role = c("aut", "cre"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

- `polarCluster()` will no longer error with multiple `pollutant`s and a single `n.clusters`.

- `importUKAQ()` will correctly append site meta data when `meta = TRUE`, `source` is a length greater than 1, and a single site is repeated in more than one source (e.g., `importUKAQ(source = c("waqn", "aurn"), data_type = "daqi", year = 2024L))`)

# openair 2.18-2

## New Features
Expand Down
4 changes: 2 additions & 2 deletions R/importUKAQ-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ readDAQI <- function(files, year, source) {
#' @param aq_data imported air quality data (annual, daqi, or otherwise)
#' @noRd
add_meta <- function(source, aq_data) {
meta_data <- importMeta(source = source)
meta_data <- importMeta(source = source, duplicate = TRUE)

meta_data <- distinct(meta_data, source, site, .keep_all = TRUE) %>%
select(source, site, code, latitude, longitude, site_type)

aq_data <- left_join(aq_data, meta_data, by = c("source", "code", "site"))
aq_data3 <- left_join(aq_data, meta_data, by = c("source", "code", "site"))

return(aq_data)
}
Expand Down

0 comments on commit 22ba291

Please sign in to comment.