[R] R ERROR- Error in file(file, "rt") : cannot open the connection

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Aug 28 15:36:00 CEST 2014

Such problems usually come from not understanding where files really are, though sometimes odd file permissions can be the culprit. Understanding how backslashes work in R strings also sometimes causes problems, though you seem to be using forward slashes so that may not apply here.

You may find that reading the help files could provide more accurate picture about the file system from R's point of view than you currently have in your mind.


You should not have to use setwd() to successfully read a file, but it can be convenient.

If you confirm the directory is there but you only see a subset of files that you expect, then you may have a permissions problem. My advice is to stay away from changing permissions if at all possible... it usually only occurs because you were doing something "As Administrator" when you shouldn't have been, and fixing that is a pit of despair and off topic here.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On August 27, 2014 10:41:23 PM PDT, Girija Kalyani <smileismystyl at gmail.com> wrote:
>Dear R Group,
>I have an species occurence file stored in dismo/ex/abc.csv.
>When i read the file, it shows error.
>Error in file(file, "rt") : cannot open the connection
>In addition: Warning message:
>In file(file, "rt") :  cannot open file
>'G:/Software/R-3.1.1/library/dismo/ex/occurence.csv': No such file or
>What could b the reason, it shows no such file in directory, but i
>saved my
>file in the place where i have mentioned in d code.
>Can someone help me out with this?
>Thanx in advanvce
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list