influxr_upload_files: Upload file(s) to InfluxDB database

Description Usage Arguments

View source: R/upload-files.R

Description

influxr_upload_files uploads a list of files to influxDB.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
influxr_upload_files(
  client,
  files,
  measurement,
  database,
  precision = c("ms", "u", "ns", "s", "m", "h"),
  tags,
  timestamp,
  timestamp_format = "%Y-%m-%d %H:%M:%OS",
  timestamp_offset = 0,
  tz = ifelse(Sys.getenv("TZ") != "", Sys.getenv("TZ"), Sys.timezone()),
  headerline = NULL,
  na_strings = c("", "NA", "N/A", "null", "None"),
  skip_lines = 0L,
  nrows = -1L,
  col.classes = NULL,
  coerce.classes = FALSE,
  select = NULL,
  sep = "auto",
  inclusive = FALSE,
  exclude_timestamp_cols = TRUE,
  recover_files = TRUE,
  read_method = "fast",
  text_preprocess_FUN = NULL,
  upload_preprocess_FUN = NULL,
  stop_on_error = TRUE,
  store_status_locally = FALSE,
  verbose = FALSE,
  ...
)

Arguments

files

character vector, containing full file names of files to be uploaded, use influxr_list_files provided with this package to get a filtered list of files according to user specified coditions.

timestamp

Where to get time stamp information for the the provided files. Can be one of the following:

  • A numeric vector specifying the column(s) of the files in which the timestamp is contained as a character string. The string will be converted to POSIXt according to timestamp_format, using tz as the timezone. If several columns are specified, their contents in each row are pasted together, separated by a single whitespace.

  • A character vector which is converted to POSIXt format according to format, using tz as the timezone.

  • A function to generate timestamp, for instance, when the filename encodes the start or the end of measurement period. In this case the filename is considered a timestamp and converted to POSIXt format according to timestamp_format, using tz as the timezone and arguments start_of_interval and resolution (see there). This can be used to process files which do not contain a timestamp variable.

  • A POSIXt vector.

timestamp_format

character. Format used for converting the timestamp to POSIXt

tz

character. Timezone of the provided measurements, the timestamp will be converted to the server timestamp before uploading. The default is the system environment variable "TZ" and if empty the system timezone Sys.timezone()'. You can specify other timezones, e.g. for time in Germany, do tz = "Etc/GMT-1". Please note the sign of the offset, which might be counter intuitive: if you are east of Greenwich you have to give a negative offset because you have to decrease your local time to make it become UTC time. For timezones west of Greenwich the offset is positive.

headerline

numeric or NULL. If numeric, it is considered the row number of the header line from which column names will be taken. If NULL, column names will depend on col.names.

skip_lines

integer. Rows to skip in each file before reading data.

nrows

numeric. Number of rows to read. -1 means all lines. See fread.

col.classes

A character vector of classes (named or unnamed), as read.csv. Or a named list of vectors of column names or numbers, see fread. If NULL, column classes are guessed.

select

A vector of column names or numbers to keep, drop the rest. select may specify types too in the same way as colClasses; i.e., a vector of colname=type pairs, or a list of type=col(s) pairs. In all forms of select, the order that the columns are specified determines the order of the columns in the result.

sep

character. The separator between columns. See fread.

exclude_timestamp_cols

logical. Should the column(s) specified in timestamp be excluded before upload?

text_preprocess_FUN

NULL or function. A function to be excuted on the file content before reading as csv

upload_preprocess_FUN

NULL or function. A function to be excuted on the content before uploading to the database (eg. calibration)

stop_on_error

Whether to stop code excution when a reading error is faced. if True instead of halting the excution, the file is ignored and a warning is shown at the end.

verbose

Be chatty and report timings?

...

Options passed to influxr_fread_recover.

na_string

character vector. Strings to be replaced with (NA) and hence excluded from uploading to the databases.

header

Passed to fread.

start_of_interval

logical. Only used if timestamp = "filename" (see there). If TRUE, the filename is considered to be the first timestamp. If FALSE, the filename is considered the last timestamp.


influxr/influxr documentation built on Aug. 5, 2020, 9:03 p.m.