[R] rbind()
MacQueen, Don
macqueen1 at llnl.gov
Sat Jan 21 01:36:46 CET 2012
As Sarah said, you have a path problem.
Are you saying that RawData is a sub-folder (sub-directory) of
SampleProject?
And you are running the script with the working directory set to
SampleProject?
[check using getwd() as Sarah suggested]
If so, it looks like it would work if you use './RawData/File1.csv'.
The ".." causes it back up one directory (folder) above the working
directory before looking for RawData.
You can also use file.choose() to find the file, and that will tell you
what the correct path is.
There's nothing special about how R on the Mac finds input files, or how
it uses rbind(). It does it in the standard R way. (I have no idea how
much different it might be using R Studio or Tinn R on Windows.)
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/20/12 12:39 PM, "Fred G" <bayespokerguy at gmail.com> wrote:
>Hello there,
>
>Much thanks in advance for any help. I have a few questions:
>
>1) Why do I keep getting the following error:
>
>File1 <- read.csv("../RawData/File1.csv",as.is=TRUE,row.names=1)
>Error in file(file, "rt") : cannot open the connection
>In addition: Warning message:
>In file(file, "rt") :
> cannot open file '../RawData/File1.csv': No such file or directory
>
>?
>
>More specifically, my directories are set up in the following way:
> SampleProject
> RawData SampleCode
>
>The current script is in the SampleCode folder. File1.csv is in the
>RawData folder. I'm a bit confused why this error keeps occurring. I
>googled it and found many other people getting the same error, but was not
>sure why mine remained incorrect...
>
>2) Ultimately what I want to do is take File1.csv, File2.csv and File3.csv
>(all in the RawData folder) and basically add them together such that it
>was as if they were all on one big csv file to begin with. I thought I
>knew how to do this but I'm using a mac now-- is there something different
>between the code to do this with R Studio and on a Mac and using Tinn R on
>Windows?
>
>In any case, I would really very much appreciate any help on both these
>issues.
>
>Thank you again.
>
>benjamin
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list