Oh strange, as it worked for me..

Thanks for providing alternative method in solving the problem!

On Fri, Sep 11, 2009 at 9:01 AM, Carl Witthoft <carl@witthoft.com> wrote:

> That will not work (or at least doesn't work for me.
>
> This does work:
>
> fnam<-'thefilename.csv'  #or build the name however you like
> fpath <- 'macintoshhd/users/me/myfolder/  # or whatever you need
>
> read.csv(eval(paste(fpath,fnam,sep=""))  #worked for me
>
>
> Carl
>
>
>
> -----------
>
> Try this:
>
> read.csv(sprintf("D://R//Data//%04d//%04d.csv", x, x), header = TRUE)
>
> On Wed, Sep 9, 2009 at 9:32 PM, Steven Kang <stochastickang@gmail.com
> >wrote:
>
> > Dear R users,
> >
> >
> > I have numerous data sets (csv files) saved in the folder which has the
> > same
> > name as individual data.
> > (i.e data x1 saved in x1 folder, data x2 in x2 folder etc)
> >
> > I would like to read in the desired data set name using 'scan' function
> and
> > assign this inputted value to an object so that it can be used in the
> > 'read.csv' function.
> >
> > For example,
> >
> > x <- scan()
> > 1: 0708
> > 2:
> > Read 1 item
> >
> > dat <- read.csv("D://R//Data//x//x.csv", head=TRUE, sep = ",")
> > Error in file(file, "r") : cannot open the connection
> > In addition: Warning message:
> > In file(file, "r") :
> >  cannot open file ('D://R//Data//x//x.csv': No such file or directory
> >
>
>
>  --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]


