I would like to be able to use gsub or gsubfn to process a formula and
to translate the variables but to ignore expressions in the formula.
Supposing that the R formula has already been transformed into a
character string and that the transformation is to convert variable
names to upper case and to append z to the names, an example would be to
convert y1 + y2 ~ a*(b + c) + d + f * (h == 3) + (sex == 'male')*i to
Y1z + Y2z ~ Az*(Bz + Cz) + Dz + Fz * (h == 3) + (sex == 'male')*Iz. Any
expression that is not just a simple variable name would be left alone.
Does anyone want to try their hand at creating a regex that would
accomplish this?
Thanks
Frank
--
Frank E Harrell Jr Professor and Chairman School of Medicine
Department of Biostatistics Vanderbilt University
______________________________________________
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.