Re: [R] parsing text files

2012-03-09 Thread jim holtman
Here is one way of doing it; it reads the file and create a 'long' version. ## input <- file("/temp/ClinicalReports.txt", 'r') outFile <- '/temp/output.txt' # tempfile() output <- file(outFile, 'w') writeLines("ID, Date, variable, value", output) ID <- NULL dataSw <- NULL repeat{ lin

Re: [R] parsing text files

2012-03-08 Thread ginger
Ooops, I forgot to specify that for each raw, containing records of the clinical reports , the values of the 22 parameter measurement have to be reported. For example, first raw, first 5 columns: ID DATE GLICEMIA AZOTEMIA CREATININEMIASODIEMIA ...

[R] parsing text files

2012-03-08 Thread ginger
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