user948950
user948950

Reputation: 1527

could you tell me what this error means?

I just ran below R code but I am getting error msg... Could anyone help me how to make this code runable on my machine. Thanks.

Here's the command:

load(file = "c:\\abcdeXXX.RData")

And here's the resulting error message:

Error in if (!grepl("RD[AX]2\n", magic)) { : argument is of length zero

Upvotes: 3

Views: 2234

Answers (2)

Andrie
Andrie

Reputation: 179578

I suspect your file is empty.

The error message means that the argument magic has length zero. If you read the source code for load, you will find the following line of code:

magic <- readChar(con, 5L, useBytes = TRUE)

Thus magic is the first 5 bytes of your file. In other words, your file is empty.

Upvotes: 9

JD Long
JD Long

Reputation: 60756

it is possible that the RData file you are trying to open is damaged or incomplete. Can you open it on another machine?

Also worth noting, early versions of R cannot open RData files created by later versions of R. Although I would not expect a version mismatch to cause your error.

Upvotes: 3

Related Questions