View source: R/split_by_pattern.R
| split_by_pattern | R Documentation |
This function scans a source directory for JSON files, loads them, and splits each file into multiple smaller JSON files based on the partial key values (pattern matching) of a specified key. Each unique value results in a separate file.
split_by_pattern(
input_dir,
output_dir,
split_key,
pattern = NULL,
data_path = NULL
)
input_dir |
Character. Path to the folder containing source JSON files. |
output_dir |
Character. Path to the folder where output files will be saved. |
split_key |
Character. The JSON key to inspect (e.g., "Sampling date"). |
pattern |
Character (Regex). A pattern to extract. If NULL, splits by full value. |
data_path |
Character. The element in the JSON containing the records list. |
The function creates the output directory if it does not exist. Filenames are generated using the pattern: original_name.json.
Logical. Returns TRUE if the operation completes successfully.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.