Learn R Programming

ORscraper (version 0.1.0)

extract_values_start_end: Extract values from start or end patterns

Description

This function appends extracted variable values based on start or end markers to a list.

Usage

extract_values_start_end(list_input, lines, pattern)

Value

An updated list with appended values.

Arguments

list_input

List. The list to append extracted values to.

lines

Character vector. The text lines to search within.

pattern

Character. The pattern to search for.

Examples

Run this code
InputPath <- system.file("extdata", package = "ORscraper")
files <- read_pdf_files(InputPath)
lines <- read_pdf_content(files[1])  # Example with the first file
diagnostic <- gender <- tumor_cell_percentage <- quality <- c()
diagnostic <- extract_values_start_end(diagnostic, lines, ".*Diagnóstico:\\s")
gender <- extract_values_start_end(gender, lines, ".*Sexo:\\s*")
tumor_cell_percentage <- extract_values_start_end(
                                tumor_cell_percentage,
                                lines,
                                ".*% células tumorales:\\s")
quality <- extract_values_start_end(
                                quality,
                                lines,
                                ".*CALIDAD DE LA MUESTRA /LIMITACIONES PARA SU ANÁLISIS:\\s")

Run the code above in your browser using DataLab