This might be hard.

How to tell f is to be changed while h is NOT ...
 

Thanks,
Guanrao

http://www.myfav5.com 
where fun and easy friend-making happens



________________________________
 From: Frank Harrell <f.harrell@vanderbilt.edu>
To: RHELP <R-help@stat.math.ethz.ch> 
Sent: Wednesday, August 14, 2013 11:13 PM
Subject: [R] regex challenge


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.
	[[alternative HTML version deleted]]

