[Rd] [External] Support for Dashes in the Raw String Delimiter

iuke-tier@ey m@iii@g oii uiow@@edu iuke-tier@ey m@iii@g oii uiow@@edu
Fri Feb 21 14:23:22 CET 2020


> r"{single quote ' and double quote " and one at the end "}"
[1] "single quote ' and double quote \" and one at the end \""

See ?Quotes for details.

The C++ syntax, on which the R syntax is based, is strictly more
powerful than the Python approach: it allows a raw string to contain
_any_ sequence of characters by adjusting the delimiter. To simplify
the implementation R only allows dashes for adjustment, but that is
sufficient:

> r"{'`"}"
[1] "'`\""
> r"-{r"{'`"}"}-"
[1] "r\"{'`\"}\""

Best,

luke

On Fri, 21 Feb 2020, Juan Telleria Ruiz de Aguirre wrote:

> Dear R Developers,
>
> As regards "Support for Dashes in the Raw String Delimiter" from commit:
>
> https://github.com/wch/r-source/commit/4d4781ad19890193d5eb458d71f18d7e53ee73c5
>
> Would it be possible to support in addition to r"" Syntax, for not escaping
> backlash character in strings, also support """ """ (Python Like Syntax),
> for also allowing to have within the character string the closing sequence
> " symbol?
>
> See Python's article on string literals for further information:
>
> https://docs.python.org/2.0/ref/strings.html
>
> Thanks!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney using uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-devel mailing list