[R] r noobie, reading my text file into r

Ivan Calandra ivan.calandra at univ-fcomte.fr
Thu Feb 6 20:44:06 CET 2014


I would guess the problem is that the file is not where you think it is 
or that you spelled the file name and/or path incorrectly.

An easy thing to try is:
read.table(file=file.choose(), header=TRUE, sep="\t")

The function file.choose() will open a window where you'll have to 
choose the file from directories. This way, you're sure to select a file 
that exists and to input the correct path.

HTH,
Ivan

--
Ivan CALANDRA
Université de Franche-Comté
UFR STGI - UMR 6249 Chrono-Environnement
4 Place Tharradin - BP 71427
25211 Montbéliard Cedex, FRANCE
+33 (0) 3 81 99 46 72 (rarely in the office)
ivan.calandra at univ-fcomte.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 06/02/14 19:00, frankreynolds a écrit :
> Hi everyone, this is my first time using r and I think I'm overlooking
> something small and I just need some help seeing it. I have a file in
> notepad that I need to read into r.
>> ceosalary<-read.table(file="C:/Users/mz106_010/Desktop/ceosalary.csv",header
>> = TRUE,sep="\t")
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>    cannot open file 'C:/Users/mz106_010/Desktop/ceosalary.csv': No such file
> or directory
>> ceosalary<-read.table(file="C:/Users/mz106_010/Desktop/ceosalary.txt",header
>> = TRUE,sep="\t")
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>    cannot open file 'C:/Users/mz106_010/Desktop/ceosalary.txt': No such file
> or directory
>
> am I writing one of those incorrectly? What can I do to fix the problem? Any
> help would be greatly appreciated.  Thanks for your time everyone!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/r-noobie-reading-my-text-file-into-r-tp4684871.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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