Re: [R] Problem with parsing a dataset - help earnestly sought

2010-04-23 Thread Jan van der Laan
Something like this? # Remove everything after ; to give the status status- sub(';.*$', '', data$cancer.problems) # Remove everything before the last ; to give tissue # In case a no ; in the string this goes wrong; correct tissue- sub('^.*;[ \n]*', '', data$cancer.problems) tissue[!

Re: [R] Problem with parsing a dataset - help earnestly sought

2010-04-23 Thread Gabor Grothendieck
We can use strapply in the gsubfn package. It extracts fields matching regular expressions. strapply extracts the parenthesized part of the regular expression (or the entire regular expression if nothing parenthesized), applies the function to it and returns the result. See

[R] Problem with parsing a dataset - help earnestly sought

2010-04-22 Thread Min-Han Tan
Dear fellow R-help members, I hope to seek your advice on how to parse/manage a dataset with hundreds of columns. Two examples of these columns, 'cancer.problems', and 'neuro.problems' are depicted below. Essentially, I need to parse this into a useful dataset, and unfortunately, I am not