[R] String problems

James MacDonald jmacdon at med.umich.edu
Mon Apr 12 20:25:21 CEST 2004


Plus, do you really want your system call to be

system("c:\\dir g:\\simulation\\at")

not sure what you want, but that is what you will get.

Jim



James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

>>> Uwe Ligges <ligges at statistik.uni-dortmund.de> 04/12/04 02:13PM >>>
MMarques Power wrote:

> after reading some docs I still can not find anything how to escape
> the "\" string
> 
> 
> I know that "\" in files needs to be escaped in order to be read by
R.
> But in Windows if I try to call any shell util I keep getting
errors.
> example:
> 
> afile <- "g:\\simulation\\at"
> works fine with read.table(afile) ...
> 
> but if I try sometthing like this:
> aprogram <- paste( "c:\dir", afile, sep=" " )
> system(aprogram)
> it crashes...
> 
> How can I remove the double "\" in the afile ?
> I know that I need to reconstruct the afile string without the
double
> "\"
> 
> Ideas ?
> or am I missing something ?

Yes, you missed to double it in "c:\dir". Try:

  afile <- "g:\\simulation\\at"
  aprogram <- paste( "c:\\dir", afile, sep=" " )
  system(aprogram)

Uwe Ligges



> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html 

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list