From 0529dd9a2919729731fd0cf2117b14b218a65e5a Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 31 Jan 2023 17:13:41 +0100 Subject: [PATCH] fix sensorType for empty ones --- R/box.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/box.R b/R/box.R index 7783cae..5824f9f 100644 --- a/R/box.R +++ b/R/box.R @@ -105,6 +105,7 @@ osem_boxes = function (exposure = NA, model = NA, grouptag = NA, else if (!is.na(date)) query$date = date_as_utc(date) %>% date_as_isostring() + do.call(get_boxes_, query) } @@ -167,6 +168,11 @@ parse_senseboxdata = function (boxdata) { if (!is.null(lastMeasurement)) thebox$lastMeasurement = isostring_as_date(lastMeasurement) + # add empty sensortype to sensors without type + if(!('sensorType' %in% names(sensors[[1]]))) { + sensors[[1]]$sensorType <- NA + } + # create a dataframe of sensors thebox$sensors = sensors %>% recursive_lapply(function (x) if (is.null(x)) NA else x) %>% # replace NULLs with NA