Can anyone tell me how to get R to include a double quote in the middle of a character string? For example, the following code is close:> fnd<-"Open fnd 'test'" > cat(fnd)Open fnd 'test'>>But instead of Open fnd 'test' I need: Open fnd "test". Difference seems minor, but I am writing batch files for another program to read in and it has to have the double quotes to work. Thanks in advance for any help or ideas, Roger ********************************************************************** * This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.
> cat('Open fnd "test"\n')Open fnd "test" > cat("Open fnd \"test\"\n") Open fnd "test" > Bos, Roger wrote:> Can anyone tell me how to get R to include a double quote in the middle > of a character string? > > For example, the following code is close: > >> fnd<-"Open fnd 'test'" >> cat(fnd) > Open fnd 'test'> > > But instead of Open fnd 'test' I need: Open fnd "test". Difference > seems minor, but I am writing batch files for another program to read in > and it has to have the double quotes to work. > > Thanks in advance for any help or ideas, > > Roger > > ********************************************************************** * > This message is for the named person's use only. It may > contain confidential, proprietary or legally privileged > information. No right to confidential or privileged treatment > of this message is waived or lost by any error in > transmission. If you have received this message in error, > please immediately notify the sender by e-mail, > delete the message and all copies from your system and destroy > any hard copies. You must not, directly or indirectly, use, > disclose, distribute, print or copy any part of this message > if you are not the intended recipient. > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
On Thu, 22 Feb 2007, Bos, Roger wrote:> Can anyone tell me how to get R to include a double quote in the middle > of a character string?FAQ 7.37 Why does backslash behave strangely inside strings?> > For example, the following code is close: > > > fnd<-"Open fnd 'test'" > > cat(fnd) > Open fnd 'test'> > > > > But instead of Open fnd 'test' I need: Open fnd "test". Difference > seems minor, but I am writing batch files for another program to read in > and it has to have the double quotes to work. > > Thanks in advance for any help or ideas, > > Roger > > ********************************************************************** * > This message is for the named person's use only. It may > contain confidential, proprietary or legally privileged > information. No right to confidential or privileged treatment > of this message is waived or lost by any error in > transmission. If you have received this message in error, > please immediately notify the sender by e-mail, > delete the message and all copies from your system and destroy > any hard copies. You must not, directly or indirectly, use, > disclose, distribute, print or copy any part of this message > if you are not the intended recipient. > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
try> cat("Open fnd \"test\"")which is the same as for C. HTH. Ranjan On Thu, 22 Feb 2007 14:09:26 -0500 "Bos, Roger" <roger.bos at us.rothschild.com> wrote:> Can anyone tell me how to get R to include a double quote in the middle > of a character string? > > For example, the following code is close: > > > fnd<-"Open fnd 'test'" > > cat(fnd) > Open fnd 'test'> > > > > But instead of Open fnd 'test' I need: Open fnd "test". Difference > seems minor, but I am writing batch files for another program to read in > and it has to have the double quotes to work. > > Thanks in advance for any help or ideas, > > Roger > > ********************************************************************** * > This message is for the named person's use only. It may > contain confidential, proprietary or legally privileged > information. No right to confidential or privileged treatment > of this message is waived or lost by any error in > transmission. If you have received this message in error, > please immediately notify the sender by e-mail, > delete the message and all copies from your system and destroy > any hard copies. You must not, directly or indirectly, use, > disclose, distribute, print or copy any part of this message > if you are not the intended recipient. > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >