[R] Substring replacement in string

Alrik Thiem alrik.thiem at gmail.com
Fri Feb 27 23:19:47 CET 2015


Dear R-help list,

I would like to replace all lower-case letters in a string that are not part
of certain fixed expressions. For example, I have the string:

"pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1, z1))"

Where I would like to replace all lower-case letters that do not belong to
the functions "pmin" and "pmax" by 1 - toupper(...) to get

"pmin(pmax(pmin(1 - X1, X2), pmin(X3, X4)) == Y, pmax(Z1, 1 - Z1))"

Any ideas on how I could achieve that?

Many thanks and best wishes,

Alrik


********************************
Alrik Thiem
Post-Doctoral Researcher

Department of Philosophy
University of Geneva
Rue de Candolle 2
CH-1211 Geneva

+41 76 527 80 83

http://www.alrik-thiem.net
http://www.compasss.org



More information about the R-help mailing list