Hello there, I am trying to get time series data form InfluxDB (1.8.4) using a Flux query from R-Studio. I always get the same error “invalid character ‘-’ in numeric literal”.
Any ideas what might be causing this issue?
dburl <- "http://localhost:8086/api/v2/query"
influxquery <- sprintf(
'from(bucket: "plcview/autogen")
|> range(start: 2017-06-27T04:16:58.278Z, stop: 2017-06-27T03:14:48.74Z)
|> filter(fn: (r) => r._measurement == "MONITORING")
|> map(fn:(r) => ({ r with _time: uint(v: r._time) }))'
)
my_raw_result <- httr::POST(url=dburl,
add_headers('Content-Type: application/vnd.flux',
'Accept: application/csv',
'Accept-Encoding: application/gzip'),
body=list(q=influxquery))
str(my_raw_result)
My data looks like this:
time MONITORING equipmentNumber workplace
---- ---------- --------------- ---------
2017-06-27T02:16:58.599Z 1 L4212M1017 3
2017-06-27T02:16:58.6Z 1 L4212M1017 4
2017-06-27T02:16:58.6Z 1 L4212M1017 1
2017-06-27T02:16:58.6Z 1 L4212M1017 2
2017-06-27T02:17:03.14Z 0 L4212M1017 1
2017-06-27T02:17:03.14Z 0 L4212M1017 2
2017-06-27T02:17:03.14Z 0 L4212M1017 4
2017-06-27T02:17:20.007Z 1 L4212M1017 1
2017-06-27T02:17:36.988Z 1 L4212M1017 4
2017-06-27T02:17:36.988Z 1 L4212M1017 2
Thank you!