R Error: bad restore file magic number – no data loaded (2 Examples)
In this R programming tutorial you’ll learn how to deal with the error message “bad restore file magic number (file may be corrupted) — no data loaded”.
Example 1: Replicating the Error Message: bad restore file magic number
saveRDS(iris, "iris.rds") # Export iris data set |
saveRDS(iris, "iris.rds") # Export iris data set
load("iris.rds") # Applying load() function (error) # Error in load("iris.rds") : # bad restore file magic number (file may be corrupted) -- no data loaded # In addition: Warning message: # file 'iris.rds' has magic number 'X' # Use of save versions prior to 2 is deprecated |
load("iris.rds") # Applying load() function (error) # Error in load("iris.rds") : # bad restore file magic number (file may be corrupted) -- no data loaded # In addition: Warning message: # file 'iris.rds' has magic number 'X' # Use of save versions prior to 2 is deprecated
Example 2: Solving the Error Message: bad restore file magic number
my_data <- readRDS("iris.rds") # Properly load iris.rds file |
my_data <- readRDS("iris.rds") # Properly load iris.rds file
Related Tutorials & Further Resources
Below, you may find some further resources on topics such as numeric values and coding errors.