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[!
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
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
3 matches
Mail list logo