Hi, I am trying to import csv file in R console I have saved my data in a file on the desktop named R and here is my problematic script> load("C:\\Users\\Anthi\\Desktop\\R\\A.csv")Error: bad restore file magic number (file may be corrupted) -- no data loaded In addition: Warning message: file ‘A.csv’ has magic number ';Abra' Use of save versions prior to 2 is deprecated when I don t load and I ask to read here is the answer> A <-read.csv("A.csv",header=TRUE)Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'A.csv': No such file or directory Do you know what should I do? Thank you in advance [[alternative HTML version deleted]]
Hi, load() is for R's binary data files. You need to use read.csv(), as you tried, but probably with the complete path. A <- read.csv("C:\\Users\\Anthi\\Desktop\\R\\A.csv", header=TRUE) Sarah On Wed, Sep 19, 2012 at 4:54 AM, Anthi Oikonomou <anthi.oikon at gmail.com> wrote:> Hi, > I am trying to import csv file in R console > I have saved my data in a file on the desktop named R and here is my > problematic script > >> load("C:\\Users\\Anthi\\Desktop\\R\\A.csv") > Error: bad restore file magic number (file may be corrupted) -- no data > loaded > In addition: Warning message: > file ?A.csv? has magic number ';Abra' > Use of save versions prior to 2 is deprecated > when I don t load and I ask to read here is the answer >> A <-read.csv("A.csv",header=TRUE) > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : cannot open file 'A.csv': No such file or directory > > > Do you know what should I do? > Thank you in advance >-- Sarah Goslee http://www.functionaldiversity.org
Hello, Try ?read.csv. dat <- read.csv("C:\\Users\\Anthi\\Desktop\\R\\A.csv") Note that unlike what happens with load() you'll need an explicit assignment. Hope this helps, Rui Barradas Em 19-09-2012 09:54, Anthi Oikonomou escreveu:> Hi, > I am trying to import csv file in R console > I have saved my data in a file on the desktop named R and here is my > problematic script > >> load("C:\\Users\\Anthi\\Desktop\\R\\A.csv") > Error: bad restore file magic number (file may be corrupted) -- no data > loaded > In addition: Warning message: > file 'A.csv' has magic number ';Abra' > Use of save versions prior to 2 is deprecated > when I don t load and I ask to read here is the answer >> A <-read.csv("A.csv",header=TRUE) > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : cannot open file 'A.csv': No such file or directory > > > Do you know what should I do? > Thank you in advance > > [[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]]
Reasonably Related Threads
- Need HELP: how find and use a csv file?
- tidy.source() gets confused when # is not a comment but a part of a literal string?
- HELP me please with import of csv to R
- Importing csv file with character values into sqlite3 and subsequent problem in R / RSQLite
- Importing a CSV file