Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error in floor(xts) : non-numeric argument to mathematical function
- [INFO] Updating the R environment index started...
- [INFO] The R environment index was updated successfully.
- > traceback()
- 10: .xts_to_influxdb_line_protocol(xts = x, use_integers = use_integers,
- measurement = measurement, precision = precision)
- 9: FUN(X[[i]], ...)
- 8: lapply(list_of_xts, function(x) {
- influxdb_line_protocol <- .xts_to_influxdb_line_protocol(xts = x,
- use_integers = use_integers, measurement = measurement,
- precision = precision)
- response <- httr::POST(url = "", httr::timeout(60), scheme = "http",
- hostname = con$host, port = con$port, path = "write",
- query = q, body = influxdb_line_protocol)
- if (response$status_code < 200 || response$status_code >=
- 300) {
- if (length(response$content) > 0)
- stop(rawToChar(response$content), call. = FALSE)
- }
- rawToChar(response$content)
- }) at influxdb.R#394
- 7: influxdbr::influx_write(con = con, db = con$db, xts = xts, measurement = measurement,
- precision = "s") at dbWrite.R#86
- 6: dbWriteMetrics(con, metricDf = metrics, startUTCs = startUTC,
- deviceId = deviceId, timespan = "6min", condition = if (rest) "rest" else "continuous",
- verbose = verbose) at metrics.R#99
- 5: processShortInterval(con, beatsXts = slice, startUTC = periodStart,
- deviceId = deviceId, verbose = verbose)
- 4: FUN(X[[i]], ...)
- 3: lapply(seq(startUTC, endUTC, by = 6 * 60), function(periodStart) {
- periodEnd <- min(endUTC, periodStart + (6 * 60))
- period <- beatsXts[index(beatsXts) >= periodStart & index(beatsXts) <
- periodEnd]
- if (!length(period)) {
- cat("WRITING MISSING-HB INTERVAL\n")
- dbWriteIntervals(con, data.frame(start = periodStart,
- end = periodEnd, type = "MISSING-HB"), deviceId = deviceId)
- }
- processShortInterval(con, beatsXts = slice, startUTC = periodStart,
- deviceId = deviceId, verbose = verbose)
- }) at metrics.R#198
- 2: (function (con, startUTC, endUTC, deviceId, verbose = TRUE)
- {
- startUTC <- as.POSIXct(startUTC, tz = "UTC")
- endUTC <- as.POSIXct(endUTC, tz = "UTC")
- cat("processing interval : ", format(startUTC), " - ", format(endUTC),
- "\n")
- cat("...pulling accelerometer data...\n")
- xtsAccel <- dbAccelSliceUTC(con, startUTC, endUTC, deviceId)
- cat("...rest detection...\n")
- riv <- detectRest.xts(xtsAccel)
- riv <- relativeToRealtimeIntervals(riv, startUTC)
- print(riv)
- nriv <- dualIntervals(riv, startUTC, endUTC)
- riv$type <- "REST"
- nriv$type <- "NON-REST"
- riv$tLen <- NULL
- subIntervals <- rbind(riv, nriv)
- subIntervals$start <- subIntervals$tStart
- subIntervals$end <- subIntervals$tEnd
- print(subIntervals)
- cat("...writing rest intervals to db...\n")
- dbWriteIntervals(con, subIntervals, deviceId)
- cat("...pulling ecg data...\n")
- xtsObj <- dbSliceUTC(con, startUTC, endUTC, deviceId)
- cat("...beat detection...\n")
- beats <- detectBeats.xts(xtsObj, datetime = as.POSIXct(startUTC,
- tz = "UTC"), samplingrate = 100)
- cat("...converting beats to xts...\n")
- beatsXts <- beatsToXts(beats, as.POSIXct(startUTC, tz = "UTC"))
- cat("...writing beats to db...\n")
- dbWriteBeats(con, beats, startUTC, deviceId)
- cat("...6-minute metrics...\n")
- lapply(seq(startUTC, endUTC, by = 6 * 60), function(periodStart) {
- periodEnd <- min(endUTC, periodStart + (6 * 60))
- period <- beatsXts[index(beatsXts) >= periodStart & index(beatsXts) <
- periodEnd]
- if (!length(period)) {
- cat("WRITING MISSING-HB INTERVAL\n")
- dbWriteIntervals(con, data.frame(start = periodStart,
- end = periodEnd, type = "MISSING-HB"), deviceId = deviceId)
- }
- processShortInterval(con, beatsXts = slice, startUTC = periodStart,
- deviceId = deviceId, verbose = verbose)
- })
- cat("...sub-interval metrics...\n")
- subRes <- mapply(processSubInterval, subIntervals$tStart,
- subIntervals$tEnd, subIntervals$type, MoreArgs = list(con = con,
- beatsXts = beatsXts), SIMPLIFY = FALSE)
- subResDf <- do.call(rbind, subRes)
- str(subResDf)
- return(subResDf)
- })(dots[[1L]][[1L]], dots[[2L]][[1L]], con = list(host = "localhost",
- port = 8086, user = "admin", pass = "", db = "care4c"), deviceId = 96,
- verbose = TRUE)
- 1: mapply(processInterval, usefulIntervals$tStart, usefulIntervals$tEnd,
- MoreArgs = list(con = con, deviceId = deviceId, verbose = TRUE),
- SIMPLIFY = FALSE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement