[R] Misunderstanding escape (backslash)

2006-10-16 Thread Frank McCown
Forgive my ignorance, but shouldn't '\\' be converted into '\' in my 
string?  In my output (below), you can see that '\\' remains '\\'.

  term = mother\'s day
  term
[1] mother's day
  term = mother\\\'s day
  term
[1] mother\\'s day  --- should be mother\'s day


Thanks,
Frank

__
R-help@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.


Re: [R] Misunderstanding escape (backslash)

2006-10-16 Thread Gabor Grothendieck
On 10/16/06, Frank McCown [EMAIL PROTECTED] wrote:
 Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
 string?  In my output (below), you can see that '\\' remains '\\'.

   term = mother\'s day
   term
 [1] mother's day
   term = mother\\\'s day
   term
 [1] mother\\'s day  --- should be mother\'s day

I think this is just  a matter of interpetation of the output:

 strsplit(mother\\'s day, NULL)[[1]]
 [1] m  o  t  h  e  r  \\ '  s d  a  y

 cat(mother\\'s day, \n)
mother\'s day

 nchar(mother\\'s day)
[1] 13

__
R-help@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.


Re: [R] Misunderstanding escape (backslash)

2006-10-16 Thread Peter Dalgaard
Gabor Grothendieck [EMAIL PROTECTED] writes:

 On 10/16/06, Frank McCown [EMAIL PROTECTED] wrote:
  Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
  string?  In my output (below), you can see that '\\' remains '\\'.
 
term = mother\'s day
term
  [1] mother's day
term = mother\\\'s day
term
  [1] mother\\'s day  --- should be mother\'s day
 
 I think this is just  a matter of interpetation of the output:
 
  strsplit(mother\\'s day, NULL)[[1]]
  [1] m  o  t  h  e  r  \\ '  s d  a  y
 
  cat(mother\\'s day, \n)
 mother\'s day
 
  nchar(mother\\'s day)
 [1] 13

And check out the new FAQ 7.37

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-backslash-behave-strangely-inside-strings_003f

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@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.


Re: [R] Misunderstanding escape (backslash)

2006-10-16 Thread Frank McCown
 And check out the new FAQ 7.37
 
 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-backslash-behave-strangely-inside-strings_003f
 

Thanks, guys, for the help.

Frank

__
R-help@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.