cleaned_field_names: Sanitise column names.

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Convert data frame column names into an Elasticsearch compatible format.

Usage

1

Arguments

colnames

A character vector containing data frame column names.

Details

Elasticsearch will not ingest field names with periods ("."), such as "Sepal.Width", as these are reserved for nested objects (in the JSON sense). This function replaces all period with underscores ("_") and the converts everything to lowercase for simplicity.

Value

A character vector with 'clean' column names.

Examples

1
2
3
4
5
6
7
## Not run: 
df <- iris
colnames(df) <- cleaned_field_names(colnames(df))
colnames(df)
# "sepal_length" "sepal_width"  "petal_length" "petal_width"  "species"

## End(Not run)

AlexIoannides/elasticsearchr documentation built on July 31, 2019, 9:36 a.m.