influx_write: Write an xts or data.frame object to an InfluxDB server

Description Usage Arguments Value References See Also

Description

This function writes either an xts object or a data.frame to an InfluxDB server. In case of an xts object, columnnames of the xts object are used as InfluxDB's field keys, xts's coredata represent field values. Attributes are preserved and written as tag keys and values, respectively.

In case of a data.frame, columns may represent times and both tag and field values. Columnnames of the data.frame object are used as InfluxDB's tag and field keys. Times and tags are optional. Use parameter time_col and tag_col to define the interpretation. By specifiying one of the arguments measurement or measurement_col, a data.frame may contain data from one measurement or multiple measurements, respectively.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
influx_write(x, con, db, measurement, rp = NULL, precision = c("s",
  "ns", "u", "ms", "m", "h"), consistency = c(NULL, "one", "quroum",
  "all", "any"), max_points = 5000, use_integers = FALSE, ...)

## S3 method for class 'xts'
influx_write(x, con, db, measurement, rp = NULL,
  precision = c("s", "ns", "u", "ms", "m", "h"), consistency = c(NULL,
  "one", "quroum", "all", "any"), max_points = 5000,
  use_integers = FALSE, ...)

## S3 method for class 'data.frame'
influx_write(x, con, db, measurement = NULL,
  rp = NULL, precision = c("s", "ns", "u", "ms", "m", "h"),
  consistency = c(NULL, "one", "quroum", "all", "any"),
  max_points = 5000, use_integers = FALSE, time_col = NULL,
  tag_cols = NULL, measurement_col = NULL, ...)

Arguments

x

The object to write to an InfluxDB server (either of class xts or data.frame).

con

An influx_connection object (s. influx_connection).

db

Sets the target database for the query.

measurement

Sets the name of the measurement (data.frame has data to write to one measurement only). If both arguments measurement and measurement_col are given, measurement gets overridden.

rp

Sets the target retention policy for the write. If not present the default retention policy is used.

precision

Sets the precision of the supplied Unix time values ("s", "ns", "u", "ms", "m", "h"). If not present timestamps are assumed to be in seconds.

consistency

Set the number of nodes that must confirm the write. If the requirement is not met the return value will be partial write if some points in the batch fail, or write failure if all points in the batch fail.

max_points

Defines the maximum points per batch (defaults to 5000).

use_integers

Should integers (instead of doubles) be written if present?

...

Arguments to be passed to methods.

time_col

A character scalar naming the time index column.

tag_cols

A character vector naming tag columns.

measurement_col

A character scalar naming the measurement column (data.frame has data to write to multiple measurements). Overrides measurement argument.

Value

A list of server responses.

References

https://docs.influxdata.com/influxdb/

See Also

xts, influx_connection


crab1234/influxdbr- documentation built on Jan. 12, 2020, 6:28 p.m.