[R] paste and path ?

Peter Dalgaard BSA
Sun, 27 Jun 1999 22:20:43 -0000

"Troels Ring" <tring at mail1.stofanet.dk> writes:

> > path <- "D:/rw0641/own/own/procedures/GFR_TIME"
> > path
> [1] "D:/rw0641/own/own/procedures/GFR_TIME"
> > path1 <- paste(path,"gfr.txt",sep="/")
> > path1
> [1] "D:/rw0641/own/own/procedures/GFR_TIME/gfr.txt"
> -- this is good enough
> > data <-
read.table("D:/rw0641/own/own/procedures/GFR_TIME/grf.txt",h=T)
> > dat1 <- read.table(path1,h=T)
> Error: "scan" can't open file
> but doesn't work
> > path1
> [1] "D:/rw0641/own/own/procedures/GFR_TIME/gfr.txt" although the
path is OK
> - the unpasted variant is of course ok. What happened ?

Strange. Just for completeness, does it work like this?

path1<-"D:/rw0641/own/own/procedures/GFR_TIME/grf.txt"
dat1 <- read.table(path1,h=T)

If it does, the trouble is in paste, otherwise in read.table...
And, what happens if you replace every / with \\ ?

--
   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907