fix sensorType for empty ones

master
jan 2 years ago
parent 379b38046d
commit 0529dd9a29

@ -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

Loading…
Cancel
Save