Sv: [R] paste and path ?

Troels Ring tring at mail1.stofanet.dk
Mon Jun 28 00:43:23 CEST 1999


The first thing did help -suggesting something in paste even though the assignment made by the paste command below seems to be identical to the direct assignment of path1 - apart from the latter being indexed ? 
-  and the / thing didn't change anything -

> path1<-"D:/rw0641/own/own/procedures/GFR_TIME/grf.txt"
> dat1 <- read.table(path1,h=T)
> 
> dat1
  day month year crea
1  12     3   94  140
2  25     9   95  144
3   3     7   96  167
4   5    12   96  174
5  12     3   97  187
6  14     6   97  188
7  23     9   97  201
> path <- "D:\\rw0641\\own\\own\\procedures\\GFR_TIME"
> path1 <- paste(path,"gfr.txt",sep="\\")
> gfr_dat <- read.table(path1,h=T)
Error: "scan" can't open file
> path1
[1] "D:\\rw0641\\own\\own\\procedures\\GFR_TIME\\gfr.txt"
> np <- "D:/rw0641/own/own/procedures/GFR_TIME"
> npp <- paste(np,"gfr.txt",sep="/")
> npp
[1] "D:/rw0641/own/own/procedures/GFR_TIME/gfr.txt"
> dat2 <- read.table(npp,h=T)
Error: "scan" can't open file


Troels Ring, MD
Department of Nephrology
Aalborg Hospital
Aalborg Denmark

----- Oprindelig meddelelse ----- 
Fra: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk>
Til: Troels Ring <tring at mail1.stofanet.dk>
Cc: R-help <r-help at stat.math.ethz.ch>
Sendt: 28. juni 1999 00:20
Emne: Re: [R] paste and path ?


> "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
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list