View source: R/extract_properties.R
extract_properties | R Documentation |
Extract Pattern-Defined Properties from Strings
extract_properties(x, patterns, replacements, as_data_frame = FALSE)
x |
vector of character |
patterns |
vector of character |
replacements |
vector of character |
as_data_frame |
logical. If |
# Define patterns to be matched against patterns <- c( "[Bb]ericht", "[- ](\\d+)$", "Abschluss", "Zwischen", "_HS$" ) # Define property:value pairs (or even prop1:value1+prob2:value2+...) # referring to parts of the pattern enclosed in parentheses with \1, \2, ... replacements <- c( "type:report", "number:\\1", "stage:final", "stage:intermediate", "author:Sonnenberg+reviewed:true" ) # Define strings in which to look for properties and their values x <- c("Bericht", "Bericht 1", "Abschlussbericht", "Zwischenbericht_HS") # Extract property values as strings extract_properties(x = x, patterns, replacements) # Arrange the properties in a data frame extract_properties(x = x, patterns, replacements, as_data_frame = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.