[R] regex challenge

Frank Harrell f.harrell at Vanderbilt.Edu
Sat Aug 17 19:49:43 CEST 2013


Bill I found a workaround:

   f <- ff(formula, lab)
   f <- as.formula(gsub("`", "", as.character(deparse(f))))

Thanks for your elegant solution.
Frank

------------------------------
Thanks Bill.  The problem is one of the results of convertName might be
'Heading("Age in Years")*age'  (this is for the tables package), and
as.name converts this to `Heading("...")*age` and the backticks cause
the final formula to have a mixture of regular elements and ` ` quoted
expression elements, making the formula invalid.
Best,
Frank
-------------------------------------------------------------------

-- 
Frank E Harrell Jr Professor and Chairman      School of Medicine
                    Department of Biostatistics Vanderbilt University



More information about the R-help mailing list