Re: [R] Non-interpreted strings

2006-07-29 Thread Prof Brian Ripley
On Thu, 27 Jul 2006, [EMAIL PROTECTED] wrote:

 I am new to R, so please forgive me if there is an obvious answer to
 this question.  I have done fairly extensive searching through R docs,
 google and a few R users and have not found an answer to my question.
 
 Is there a way to create a non-interpreted string object in R?
 
 For example, I am using R in a MS Windows environment and I would like
 to paste DOS paths into some R command:
   setwd(c:\some\directory)
 
 Obviously this does not work because of the escaping mechanism.  And I
 know the obvious answer, use \\.  But if you do a lot of pasting into
 R it could get tedious manually editing escape sequences.

Why manually edit?  You can do this many ways, including with R (reading 
from a file or from a separate line).  E.g.

 setwd(readline(new dir: ))
new dir: c:\TEMP
 getwd()
[1] c:/TEMP

 I did find a workable solution to this particular problem:
   setwd(choose.dir())EnterPasteEnter
 This saves me from having to do the editing myself.  I can conceive of
 other examples of wanting to paste other more abstract stings into R
 that may happen to have a \ in it.  And now, thanks to choose.dir(), I
 have a way to do the translation automagically but...
 
 My question is, is there any way in R to not interpret the string and
 store the string as is?  For instance, Perl allows you to do interpreted
 ( ) and non-interpreted strings (' ').  This does not work in R; ' '
 acts just like   and my testing indicates that the interpretation is
 done at parse time.  Is there any language level construct for creating
 a non-interpreted string in R?

No.

 
   [[alternative HTML version deleted]]
 
 __
 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.

[Please do, not send HTML code and BTW the answer is in the recent list 
archives.]
 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Non-interpreted strings

2006-07-28 Thread Gabor Grothendieck
Enter this at the console

   x - scan(what = )

and after pressing the enter after the right paren,
do a paste and then press enter twice.


On 7/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I am new to R, so please forgive me if there is an obvious answer to
 this question.  I have done fairly extensive searching through R docs,
 google and a few R users and have not found an answer to my question.

 Is there a way to create a non-interpreted string object in R?

 For example, I am using R in a MS Windows environment and I would like
 to paste DOS paths into some R command:
setwd(c:\some\directory)

 Obviously this does not work because of the escaping mechanism.  And I
 know the obvious answer, use \\.  But if you do a lot of pasting into
 R it could get tedious manually editing escape sequences.

 I did find a workable solution to this particular problem:
setwd(choose.dir())EnterPasteEnter
 This saves me from having to do the editing myself.  I can conceive of
 other examples of wanting to paste other more abstract stings into R
 that may happen to have a \ in it.  And now, thanks to choose.dir(), I
 have a way to do the translation automagically but...

 My question is, is there any way in R to not interpret the string and
 store the string as is?  For instance, Perl allows you to do interpreted
 ( ) and non-interpreted strings (' ').  This does not work in R; ' '
 acts just like   and my testing indicates that the interpretation is
 done at parse time.  Is there any language level construct for creating
 a non-interpreted string in R?

[[alternative HTML version deleted]]

 __
 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.


__
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] Non-interpreted strings

2006-07-28 Thread Gabor Grothendieck
Or even easier,

x - scan(clipboard, what = )

at least on Windows.


On 7/28/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Enter this at the console

   x - scan(what = )

 and after pressing the enter after the right paren,
 do a paste and then press enter twice.


 On 7/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  I am new to R, so please forgive me if there is an obvious answer to
  this question.  I have done fairly extensive searching through R docs,
  google and a few R users and have not found an answer to my question.
 
  Is there a way to create a non-interpreted string object in R?
 
  For example, I am using R in a MS Windows environment and I would like
  to paste DOS paths into some R command:
 setwd(c:\some\directory)
 
  Obviously this does not work because of the escaping mechanism.  And I
  know the obvious answer, use \\.  But if you do a lot of pasting into
  R it could get tedious manually editing escape sequences.
 
  I did find a workable solution to this particular problem:
 setwd(choose.dir())EnterPasteEnter
  This saves me from having to do the editing myself.  I can conceive of
  other examples of wanting to paste other more abstract stings into R
  that may happen to have a \ in it.  And now, thanks to choose.dir(), I
  have a way to do the translation automagically but...
 
  My question is, is there any way in R to not interpret the string and
  store the string as is?  For instance, Perl allows you to do interpreted
  ( ) and non-interpreted strings (' ').  This does not work in R; ' '
  acts just like   and my testing indicates that the interpretation is
  done at parse time.  Is there any language level construct for creating
  a non-interpreted string in R?
 
 [[alternative HTML version deleted]]
 
  __
  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.
 


__
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.