Hi, Using the full path specification, as you have done in your second example, is a good idea. Have you tried forward slashes? If I am reading the docs correctly you should be able to use either forward or back slashes. I haven't used R in Windows for ages, but my memory is that switching to forward slashes skirted any troublesome issues. Try this...
filename <- "C:/Program Files/R/R-3.2.3/Appendix/DATA1.txt" if (file.exists(filename)){ X <- scan(file = filename, what = double()) } else { cat('file not found\n') } Here's the doc page... https://cran.r-project.org/doc/manuals/r-release/R-intro.html#OS-facilities Ben > On Feb 7, 2016, at 3:23 PM, Walter Niessen <nies...@att.net> wrote: > > Helpers, > > I am a pretty savvy computer user (over 40 years) but am having trouble with > the most basic process in using the R program. I am taking a course to learn > the statistics utility of “R” but can’t seem to get past the opening where it > shows the student how to input data into R. > > It suggests identifying as the a target folder in the Properties of the R x64 > 3.2.3 icon (I use a 64-bit Windows 7 OS) the location where data files are > found. I entered: > > As the Target: "C:\Program Files\R\R-3.2.3\bin\x64\Rgui.exe" ... which > contains Rgui.exe and the supporting dlls etc. > > As the Start in: "C:\Program Files\R\R-3.2.3\Appendix" ... where Appendix is > a folder which contains data files such as the text file DATA1.txt which I > created from an Excel file. > > When I try and get R to input the data, I get the following sequence of > messages: > > >> X=scan("DATA1.txt") > Error in file(file, "r") : cannot open the connection > In addition: Warning message: > In file(file, "r") : > cannot open file 'DATA1.txt': No such file or directory > > When I try again but use the complete file description, I get: > > X=scan("C:\Program Files\R\R-3.2.3\Appendix\DATA1.txt") > Error: '\P' is an unrecognized escape in character string starting ""C:\P" > > I hate to ask a question not related to R or its features (that may come > later), but, clearly, the first baby step is to be able to load data into the > application . . . and, I am really frustrated with my inability to do so. I > apologize for this but really need to get past this business to jump into the > REAL use of R. > > Can you help? > > Walt > > Walter R. Niessen > (978) 470-4622 > > P.S. I apologize, but I sent the first “edition” a few minutes ago without a > Subject and not quite finished up. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.