Learn R Programming

piton (version 1.0.0)

peg_sum: Example PEG

Description

an example of a Parsing Expression Grammar (PEG) that takes a comma-separated string of digits and sums them together

Usage

peg_sum(x)

Value

a vector of numbers, containing either the sum of the equivalent element of x or (if the element could not be parsed) NA.

Arguments

x

a vector of strings, each containing a comma-separated set of digits

Examples

Run this code
# Simple example
peg_sum("1,2, 5, 91, 34")

Run the code above in your browser using DataLab