refine_add_column {rrefine} | R Documentation |
Add column to OpenRefine project
Description
This function will add a column to an existing OpenRefine project via an API query to /command/core/apply-operations
and the core/column-addition
operation. The value for the new column can be specified in this function either based on value of an existing column. The value can be defined using an expression written in General Refine Expression Language (GREL) syntax.
Usage
refine_add_column(
new_column,
new_column_index = 0,
base_column = NULL,
value,
mode = "row-based",
on_error = "set-to-blank",
project.name = NULL,
project.id = NULL,
verbose = FALSE,
validate = TRUE,
...
)
Arguments
new_column |
Name of the new column |
new_column_index |
Index at which the new column should be placed in the project; default is |
base_column |
Name of the column on which the value will be based; default is |
value |
Definition of the value for the new column; can accept a GREL expression |
mode |
Mode of operation; must be one of |
on_error |
Behavior if there is an error on new column creation; must be one of |
project.name |
Name of project |
project.id |
Unique identifier for project |
verbose |
Logical specifying whether or not query result should be printed; default is |
validate |
Logical as to whether or not the operation should validate parameters against existing data in project; default is |
... |
Additional parameters to be inherited by |
Value
Operates as a side-effect passing operations to the OpenRefine instance. However, if verbose=TRUE
then the function will return an object of the class "response".
Examples
## Not run:
fp <- system.file("extdata", "lateformeeting.csv", package = "rrefine")
refine_upload(fp, project.name = "lfm")
refine_add_column(new_column = "date_type",
value = "grel:value.type()",
base_column = "theDate",
project.name = "lfm")
refine_add_column(new_column = "example_value",
new_column_index = 0,
value = "1",
project.name = "lfm")
## End(Not run)