Error messages loading .csv E.g. Use of save versions prior to 2 is deprecated

Trying to load an .csv file. I get the following error messages when trying to load not only this file ( resourcecurse.csv ) but also other files in the same file location (which I was able to load previously using read.csv("filename.ext")). I've tried read.csv(), load(), and readRDS(), but may be using them incorrectly.

1.

# set working directory
setwd("~/Documents/PolSci/Quan/RStudio")
curse <- read.csv("resourcecurse.csv")

Error message:

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'resourcecurse.csv': No such file or directory

2.

load("data/resourcecurse.csv")

Error message:

Error in load("data/resourcecurse.csv") : 
  bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘resourcecurse.csv’ has magic number 'count'
  Use of save versions prior to 2 is deprecated

3.

In gzfile(file, "rb") :

Error message:

Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
  cannot open compressed file 'resourcecurse.csv', probable reason 'No such file or directory'

My r version is 4.2.1, and RStudio version is 2022.07.2 Build 576.

Thank you kind internet people.

From those functions, only read.csv() works for reading csv files, the other 2 have other purposes.

I think your problem is that you are incorrectly defining the file path. Your file is not located at ~/Documents/PolSci/Quan/RStudio/resourcecurse.csv

Look for your file using the Windows File Explorer so you can copy its actual path.

1 Like

Thank you very much kind stranger

For find the path of any file Im use file.choose().
Next appear a windows for search the file, press open and console show the correct path.

You could copy and paste. Is very fast.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.