Learn R Programming

nc (version 2025.3.24)

Named Capture to Data Tables

Description

User-friendly functions for extracting a data table (row for each match, column for each group) from non-tabular text data using regular expressions, and for melting columns that match a regular expression. Patterns are defined using a readable syntax that makes it easy to build complex patterns in terms of simpler, re-usable sub-patterns. Named R arguments are translated to column names in the output; capture groups without names are used internally in order to provide a standard interface to three regular expression 'C' libraries ('PCRE', 'RE2', 'ICU'). Output can also include numeric columns via user-specified type conversion functions.

Copy Link

Version

Install

install.packages('nc')

Monthly Downloads

422

Version

2025.3.24

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Toby Hocking

Last Published

April 9th, 2025

Functions in nc (2025.3.24)

measure_multiple

measure multiple
group

Capture group
measure

measure
field

Capture a field
capture_melt_single

Capture and melt into a single column
collapse_some

collapse some
check_names

check names
check_df_names

check df names
capture_melt_multiple

Capture and melt into multiple columns
quantifier

quantifier
try_or_stop_print_pattern

try or stop print pattern
stop_for_capture_same_as_id

stop for capture same as id
var_args_list

var args list
measure_single

measure single
melt_list

melt list
subject_var_args

subject var args
stop_for_engine

stop for engine
only_captures

only captures
stop_for_subject

stop for subject
capture_first_df

Capture first match in columns of a data frame
capture_all_str

Capture all matches in a single subject string
apply_type_funs

apply type funs
alternatives_with_shared_groups

alternatives with shared groups
alevels

Alternative levels
alternatives

alternatives
altlist

altlist
capture_first_glob

capture first glob
capture_first_vec

Capture first match in each character vector element
capture_longer_spec

capture longer spec