1

I have been working on the same R script now for 5 months, had some minor coding problems, but this morning I got a problem that makes me unable to run the whole script. To clean my imported data I use a lot of subset(), but this morning when running the code I got the Warning:

Error in subset(T23810, date < as.Date("2015-10-22")) : byte code version mismatch

It appears that I only get this warning after trying to run a subset function, but it blocks my whole script at the moment. What could be the cause and solution for this?

EDIT: Reproducible example

x = structure(list(names = structure(c(11L, 3L, 5L, 27L, 26L, 15L, 
18L, 13L, 8L, 2L, 22L, 12L, 1L, 25L, 29L, 31L, 6L, 23L, 28L, 
14L, 19L, 4L, 10L, 16L, 9L, 17L, 21L, 30L, 7L, 6L, 27L, 26L, 
12L, 13L, 14L, 4L, 28L, 15L, 31L, 23L, 1L, 22L, 11L, 18L, 3L, 
20L, 8L, 5L, 16L, 2L, 25L, 30L, 21L, 4L, 6L, 3L, 5L, 27L, 14L, 
11L, 26L, 31L, 13L, 18L, 15L, 1L, 23L, 2L, 8L, 28L, 30L, 20L, 
22L, 12L, 10L, 16L, 21L, 25L, 17L, 24L, 32L, 31L, 23L, 26L, 1L, 
18L, 11L, 12L, 3L, 15L, 27L, 28L, 5L, 22L, 6L, 17L, 20L, 2L, 
8L, 21L, 30L, 13L, 25L, 24L, 7L, 4L, 10L, 16L, 14L), .Label = c("50/50", 
"Babylon", "Big Rock Market", "Core Gut", "Customs House", "David's Dropoff", 
"David's Dropoff Deep", "Diamond Rock", "Giles Quarter", "Green Island", 
"Greer Gut", "Hole in the Corner", "Hot Springs", "Ladder Labyrinth", 
"Man O War", "Mount Michel", "Muck Dive", "Outer Limits", "Poriotes Point", 
"Porites Point", "Rays & Anchors", "Shark Shoals", "Tedran", 
"Tent Boulders", "Tent Deep", "Tent Reef", "Tent Wall", "Third Encounter", 
"Torens Point", "Torrens Point", "Twilight Zone", "Wells Bay"
), class = "factor")), .Names = "names", row.names = c(NA, -109L
), class = "data.frame")

Then if I execute the following:

x[x=="Torens Point"] = "Torrens Point"
x[x=="Poriotes Point"] = "Porites Point"
x = droplevels(subset(x, names != "Muck Dive"))

I get the error:

Error in subset(x, names != "Muck Dive") : byte code version mismatch
Shark167
  • 581
  • 1
  • 8
  • 16
  • 1
    Without more information it is impossible to know what the cause is. The first hit when googling the error message is https://stat.ethz.ch/pipermail/r-help/2011-November/294486.html. It seems you loaded/attached a package for a previous version of R. Perhaps it is automatically loaded. I am voting to close. – Jan van der Laan Feb 17 '16 at 08:28
  • Thanks! What do you want to know more, as it is impossible to replicate the script (as you need my datasheet of over 160k observations). I only get the warning when I use subset, which is (I guess) in the base of R. So how can it be of a different version? – Shark167 Feb 17 '16 at 08:34
  • 1
    I understand, but a specific unreproducible bug, that is probably caused by some specific setup of your system, is probably of little use to other users of stackoverflow. Try starting R without loading and executing any user scripts/data (remove the `.RData` from the startup directory; rename your RProfile). Try updating all of your packages `update.packages()`. – Jan van der Laan Feb 17 '16 at 08:40
  • 1
    I added a reproducible example. Hope you can help me.. – Shark167 Feb 17 '16 at 08:45
  • 1
    I retracted my close vote because the post now contains the required information. However, I'm afraid that I can't help because I cannot reproduce the error; the code runs without error on my machine. Maybe somebody can give you a hint if you also post the output of `sessionInfo()`. – RHertel Feb 17 '16 at 08:50

1 Answers1

0

Okay solved it and in the end it was pretty easy. Since I am working on a server and rely on versions of R that are installed on that server I didn't realize how to update R itself. Now I got it it seems to work. Thank you all for your help! This one is SOLVED!

Shark167
  • 581
  • 1
  • 8
  • 16