Re: [R] field values from text file to dataframe

2017-03-13 Thread Ulrik Stervbo
I imagine that the FieldStateOption is irrelevant, so you might be able to create a data.frame like this: library(tidyr) fl <- readLines("pdf_dump.txt") fl <- grep("FieldStateOption", fl, value = TRUE, invert = TRUE) field_number <- vector(mode = "integer", length = length(fl)) tmpid <- 0 for(i

Re: [R] field values from text file to dataframe

2017-03-13 Thread Jim Lemon
Hi Vijayan, You have a bit of a problem with repeated field names. While you can mangle the field names to do something like this, I don't see how you are going to make sense of multiple "FieldStateOption" fields. The strategy I would take is to collect all of the field names and then set up rows w

[R] field values from text file to dataframe

2017-03-11 Thread Vijayan Padmanabhan
Dear r-help group I have a text file which is a data dump of a pdf form as given below.. I want it to be converted into a data frame with field name as column names and the field value as the row value for each field. I might have different pdf forms with different field name value pairs to process