Skip to content

passing ", betrayed by the non-vanishing \

4 messages · graham lawrence, Peter Dalgaard, Thomas Lumley +1 more

#
mtex[3]<-"I need\'s a \"double quote\" with no backslash"
mtex[3]
[1] "I need's a \"double quote\" with no backslash"

so how is it done?  Thanks in advance,

graham lawrence

_________________________________________________________________


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"graham lawrence" <forporphyry at hotmail.com> writes:
You's got two of them in there already! Try cat(mtex[3], "\n")

Printing character strings will always escape double quotes,
backaslashes and various control characters. No way around that except
by using cat().
#
On Tue, 16 Apr 2002, graham lawrence wrote:

            
Do you want to construct a string that contains a double quote and no
backslash or to print a double quote on the screen without printing a
backslash?

You've done the first, as this shows
[1] "\""
[1] 1
so a contains a single character, the double quote.

To display on the screen without a backslash use
[1] "
or
">

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
PD> "graham lawrence" <forporphyry at hotmail.com> writes:

    >>> mtex[3]<-"I need\'s a \"double quote\" with no backslash"
    >>> mtex[3]
    >>> [1] "I need's a \"double quote\" with no backslash"

    >>> so how is it done?  Thanks in advance,

    PD> You's got two of them in there already! Try
    > cat(mtex[3], "\n")

    PD> Printing character strings will always escape double quotes,
    PD> backaslashes and various control characters. No way around that except
    PD> by using cat().

the really amusing thing about this topic: about a dozen mail
hosts from R-help subscribers have bounced the above message,
giving as reason
Quite a funny example of an error of the 2nd kind when trying to
do spam/virus protection...

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._