Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. Error in floor(xts) : non-numeric argument to mathematical function
  2.  
  3. [INFO] Updating the R environment index started...
  4.  
  5. [INFO] The R environment index was updated successfully.
  6. > traceback()
  7. 10: .xts_to_influxdb_line_protocol(xts = x, use_integers = use_integers,
  8. measurement = measurement, precision = precision)
  9. 9: FUN(X[[i]], ...)
  10. 8: lapply(list_of_xts, function(x) {
  11. influxdb_line_protocol <- .xts_to_influxdb_line_protocol(xts = x,
  12. use_integers = use_integers, measurement = measurement,
  13. precision = precision)
  14. response <- httr::POST(url = "", httr::timeout(60), scheme = "http",
  15. hostname = con$host, port = con$port, path = "write",
  16. query = q, body = influxdb_line_protocol)
  17. if (response$status_code < 200 || response$status_code >=
  18. 300) {
  19. if (length(response$content) > 0)
  20. stop(rawToChar(response$content), call. = FALSE)
  21. }
  22. rawToChar(response$content)
  23. }) at influxdb.R#394
  24. 7: influxdbr::influx_write(con = con, db = con$db, xts = xts, measurement = measurement,
  25. precision = "s") at dbWrite.R#86
  26. 6: dbWriteMetrics(con, metricDf = metrics, startUTCs = startUTC,
  27. deviceId = deviceId, timespan = "6min", condition = if (rest) "rest" else "continuous",
  28. verbose = verbose) at metrics.R#99
  29. 5: processShortInterval(con, beatsXts = slice, startUTC = periodStart,
  30. deviceId = deviceId, verbose = verbose)
  31. 4: FUN(X[[i]], ...)
  32. 3: lapply(seq(startUTC, endUTC, by = 6 * 60), function(periodStart) {
  33. periodEnd <- min(endUTC, periodStart + (6 * 60))
  34. period <- beatsXts[index(beatsXts) >= periodStart & index(beatsXts) <
  35. periodEnd]
  36. if (!length(period)) {
  37. cat("WRITING MISSING-HB INTERVAL\n")
  38. dbWriteIntervals(con, data.frame(start = periodStart,
  39. end = periodEnd, type = "MISSING-HB"), deviceId = deviceId)
  40. }
  41. processShortInterval(con, beatsXts = slice, startUTC = periodStart,
  42. deviceId = deviceId, verbose = verbose)
  43. }) at metrics.R#198
  44. 2: (function (con, startUTC, endUTC, deviceId, verbose = TRUE)
  45. {
  46. startUTC <- as.POSIXct(startUTC, tz = "UTC")
  47. endUTC <- as.POSIXct(endUTC, tz = "UTC")
  48. cat("processing interval : ", format(startUTC), " - ", format(endUTC),
  49. "\n")
  50. cat("...pulling accelerometer data...\n")
  51. xtsAccel <- dbAccelSliceUTC(con, startUTC, endUTC, deviceId)
  52. cat("...rest detection...\n")
  53. riv <- detectRest.xts(xtsAccel)
  54. riv <- relativeToRealtimeIntervals(riv, startUTC)
  55. print(riv)
  56. nriv <- dualIntervals(riv, startUTC, endUTC)
  57. riv$type <- "REST"
  58. nriv$type <- "NON-REST"
  59. riv$tLen <- NULL
  60. subIntervals <- rbind(riv, nriv)
  61. subIntervals$start <- subIntervals$tStart
  62. subIntervals$end <- subIntervals$tEnd
  63. print(subIntervals)
  64. cat("...writing rest intervals to db...\n")
  65. dbWriteIntervals(con, subIntervals, deviceId)
  66. cat("...pulling ecg data...\n")
  67. xtsObj <- dbSliceUTC(con, startUTC, endUTC, deviceId)
  68. cat("...beat detection...\n")
  69. beats <- detectBeats.xts(xtsObj, datetime = as.POSIXct(startUTC,
  70. tz = "UTC"), samplingrate = 100)
  71. cat("...converting beats to xts...\n")
  72. beatsXts <- beatsToXts(beats, as.POSIXct(startUTC, tz = "UTC"))
  73. cat("...writing beats to db...\n")
  74. dbWriteBeats(con, beats, startUTC, deviceId)
  75. cat("...6-minute metrics...\n")
  76. lapply(seq(startUTC, endUTC, by = 6 * 60), function(periodStart) {
  77. periodEnd <- min(endUTC, periodStart + (6 * 60))
  78. period <- beatsXts[index(beatsXts) >= periodStart & index(beatsXts) <
  79. periodEnd]
  80. if (!length(period)) {
  81. cat("WRITING MISSING-HB INTERVAL\n")
  82. dbWriteIntervals(con, data.frame(start = periodStart,
  83. end = periodEnd, type = "MISSING-HB"), deviceId = deviceId)
  84. }
  85. processShortInterval(con, beatsXts = slice, startUTC = periodStart,
  86. deviceId = deviceId, verbose = verbose)
  87. })
  88. cat("...sub-interval metrics...\n")
  89. subRes <- mapply(processSubInterval, subIntervals$tStart,
  90. subIntervals$tEnd, subIntervals$type, MoreArgs = list(con = con,
  91. beatsXts = beatsXts), SIMPLIFY = FALSE)
  92. subResDf <- do.call(rbind, subRes)
  93. str(subResDf)
  94. return(subResDf)
  95. })(dots[[1L]][[1L]], dots[[2L]][[1L]], con = list(host = "localhost",
  96. port = 8086, user = "admin", pass = "", db = "care4c"), deviceId = 96,
  97. verbose = TRUE)
  98. 1: mapply(processInterval, usefulIntervals$tStart, usefulIntervals$tEnd,
  99. MoreArgs = list(con = con, deviceId = deviceId, verbose = TRUE),
  100. SIMPLIFY = FALSE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement