Hello, I have a .txt file with many clinical exams reports (two examples of which are attached to the message). I have to create a data frame with as many rows as the number of clinical exams reports in the text file and 24 columns: the first (to be labelled as "ID") with a number (representing an identification code) which is the number in the 13th line of the clinical report following the string "Acc.ne n. " the second (to be labelled as "DATE") with a date (indicating date of blood sampling), which is the date, again in the 13th line, following the identification code the following 22 columns (to be labelled with the name of parameters at lines from 20 to 41, as "GLICEMIA" ... "COLESTEROLO LDL")
I did search in the mailing list and tried to begin something like: #read the text file reports <- readLines("ClinicalReports.txt") #processing the file starting at each "Acc.ne n. " serologic <- lapply(which(grepl("^Acc.ne n.", reports)), function(.line ).... but I'm a biostatistician whith almost no expertise in programming and I really need your hepl! Please!!! http://r.789695.n4.nabble.com/file/n4456355/ClinicalReports.txt ClinicalReports.txt -- View this message in context: http://r.789695.n4.nabble.com/parsing-text-files-tp4456355p4456355.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.