On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius <dwinsem...@comcast.net>wrote:
> > On Oct 28, 2009, at 11:46 AM, Val wrote: > > Val, please take it slow, you are missing basic stuff here. >> >>> >>> (1) Windows Explorer may hide extensions; the 'Type' column should >>> read 'R file' anyway. >>> >>> >> * Yes I looked at it and it only shows type. To check I downloaded >> another script with R extension "test.R" and the type column shows the >> exact extension(i.e., test.R). >> * >> >> >> >>> (2) Script files are included in your workspace with the comand source(). >>> Please type ?source for details. >>> >>> (3) You should call files with their path and extensions (in your case >>> 'Rossi.R') >>> I can open the script using this command, >>> >>> * Rossi <- read.table( file.choose(),header=T) >> * >> *Why I can not open with this command?* >> >> Rossi <- read.table("C:/Documents and Settings/Val/My >> Documents/R_data/prd/Rossi.dat",header=T) >> >> *David, >> *You suggested to use , >> >> Rossi <- read.table(paste("C:/Documents and Settings/Val/My >> Documents/R_data/prd", "Rossi.dat", sep="/"), header=T) >> >> This is not working as well I got the same error message. >> > > H0: there is no file by that name in that directory. > HA: (or Windows and the email process is mucking up the spaces in the > path). I do not "see" a space between "My" and "Documents" in the email > representation. > > I originally asked and you never answered...HOW did your save "Rossi" or > "Rossi.dat"? Code and output ... we want all your code and console output! > > *Sorry for that and this is the code that was saved as "Ross.R". Now I manged to save it as *.R. By default when I clicked file --> save as ---> the window asks file name and shows save as type --> R files(*.R) file type. In my case I was typing only the file name " Ross" without the extension assuming that the window will append the extension since it asked me R files(*.R). I thought it is just like the other windows program like Word or Excel. Now I have to type the full file name Ross.R. The script file name is Ross.R * *Rossi <- read.table(paste("C:/Documents and Settings/Val/My Documents/R_data/prd", "Rossi.dat", sep="/"), header=T)* the console output is Error in file(file, "r") : cannot open the connection In addition: Warning message: In file(file, "r") : cannot open file 'C:/Documents and Settings/Val/My Documents/R_data/prd/Rossi.dat': No such file or directory > So, please reproduce complete code and complete error messages. There are > often details in those messages that new users are unable to decode. > > > > >> Any help is highly appreciated >> >> Val >> >> >> >> >> >> >> >> >> >> Hope the above help, >>> >>> >>> On Wed, Oct 28, 2009 at 3:55 PM, Val <valkr...@gmail.com> wrote: >>> >>>> The working directory is >>>> >>>> getwd() >>>>> >>>> [1] "C:/Documents and Settings/Val/My Documents" >>>> >>>> The data file(Rossi.dat) and the script(Rossi.R) are in >>>> "C:/Documents and Settings/Val/My Documents/R_data/prd" >>>> >>>> How should I write to read the file? >>>> >>>> source(???) # what should be included here? >>>> >>>> Rossi <- read.table('Rossi.dat',header=T) >>>> >>>>> >>>>> >>>> I still got the same error message. >>>> >>>> Error in file(file, "r") : cannot open the connection >>>> In addition: Warning message: >>>> In file(file, "r") : cannot open file 'Rossi': No such file or directory >>>> >>>> >>>> Thanks >>>> Val >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Wed, Oct 28, 2009 at 10:32 AM, David Winsemius < >>>> >>> dwinsem...@comcast.net>wrote: >>> >>>> >>>> >>>>> On Oct 28, 2009, at 10:04 AM, Val wrote: >>>>> >>>>> Hi User's, >>>>> >>>>>> >>>>>> This might be a simple question but it is giving me a hard time as I >>>>>> am >>>>>> >>>>> a >>> >>>> new user. >>>>>> I installed R version 2.9.2 (2009-08-24) >>>>>> >>>>>> 1. I just copied a short script from Fox (2002) as a practice and >>>>>> >>>>> wanted >>> >>>> to save it as Rossi.R. >>>>>> >>>>>> >>>>> How? >>>>> >>>>> >>>>> The system saved it without complain but when I looked at using a >>>>> >>>> windows >>> >>>> explorer it is not *.R file but only Rossi. Why this is happening? >>>>>> >>>>>> >>>>> If you were to include the code, we perhaps could tell you. In its >>>>> >>>> default >>> >>>> mode Windows may be hiding the extension from you. (Or possibly because >>>>> >>>> R >>> >>>> does not postpend file types and (I am now guessing here about a package >>>>> >>>> I >>> >>>> have not used and don't even know if you are) neither does Rcmdr.) >>>>> >>>>> >>>>> >>>>> >>>>> 2. the script and the data files are in the same working directory. >>>>>> >>>>> When I >>> >>>> run the following script >>>>>> >>>>>> Rossi <- read.table('Rossi',header=T) >>>>>> >>>>>>> >>>>>>> >>>>>> No path specification. And ??? thought you said it was a script, >>>>> which >>>>> would have been loaded with source() >>>>> >>>>> >>>>> Rossi[1:5,1:10] >>>>> >>>>>> >>>>>>> >>>>>> But this suggests you are using it as data. ???? >>>>> >>>>> What do you get when your type this: >>>>> >>>>> getwd() >>>>> >>>>> the working directory is > getwd() >>>>> >>>> [1] "C:/Documents and Settings/val/My Documents" >>>> >>>>> getwd() >>>>> >>>> >>>> >>>> >>>> >>>> >>>> Maybe if you tried (untested)... Nah ... not going to do further >>>>> >>>> guessing. >>> >>>> Read the posting guide and supply the missing elements. >>>>> >>>>> >>>>> >>>>> >>>>> I got the following error messages >>>>>> >>>>>> Error in file(file, "r") : cannot open the connection >>>>>> In addition: Warning message: >>>>>> In file(file, "r") : cannot open file 'Rossi': No such file >>>>>> >>>>> or >>> >>>> directory >>>>>> >>>>>> Rossi[1:5,1:10] >>>>>>> >>>>>>> Error: object 'Rossi' not found >>>>>> >>>>>> >>>>>> Thank you for your help in advance >>>>>> >>>>>> Val >>>>>> >>>>>> -- >>>>> >>>>> David Winsemius, MD >>>>> Heritage Laboratories >>>>> West Hartford, CT >>>>> >>>>> >>>>> >>>> [[alternative HTML version deleted]] >>>> >>>> ______________________________________________ >>>> 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 >>> >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> >>> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> 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 >> and provide commented, minimal, self-contained, reproducible code. >> > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > [[alternative HTML version deleted]] ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.