Hi,
So I have everything written out. I used R-studio (same as R console
but with an IDE) and I had no trouble calling upon and opening the csv
file for computation.
However, when I try to run my code in plain old R, it says that the
file could not be located. Heres my code:
func <- function(filename, int) {
? Data <- read.csv("sample.csv", header = TRUE)
? attach(Data, warn.conflicts = FALSE)
...........
..........
}
I made sure that sample file was in the same directory. I even tried
inputting the entire file location "C:\Users..."
Please help. Thanks
Opening excel CSV file in R
2 messages · Dan Zhou, Uwe Ligges
On 09.11.2011 04:42, Dan Zhou wrote:
Hi,
So I have everything written out. I used R-studio (same as R console
but with an IDE) and I had no trouble calling upon and opening the csv
file for computation.
However, when I try to run my code in plain old R, it says that the
file could not be located. Heres my code:
func<- function(filename, int) {
Data<- read.csv("sample.csv", header = TRUE)
attach(Data, warn.conflicts = FALSE)
...........
..........
}
I made sure that sample file was in the same directory.
Which "same" directory? Have you checked getwd() before running func()?
I even tried inputting the entire file location "C:\Users..."
But hopefully not that way. You need to escape backslahes as in "c:\\Users" or, much easiest, use forwward slahes. See the R for Windows FAQs. Uwe Ligges
Please help. Thanks
______________________________________________ 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.