使用子集时字节代码版本不匹配

时间:2016-02-17 08:07:48

标签: r warnings bytecode

我现在已经在同一个R脚本上工作了5个月,遇到了一些小的编码问题,但今天早上我遇到了一个问题,导致我无法运行整个脚本。为了清理我导入的数据,我使用了很多的子集(),但今天早上运行代码时我得到了警告:

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

看起来我在尝试运行子集函数后才会收到此警告,但此时它会阻止我的整个脚本。可能是什么原因和解决方案?

编辑:可重复的示例

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")

然后,如果我执行以下内容:

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

我收到错误:

Error in subset(x, names != "Muck Dive") : byte code version mismatch

1 个答案:

答案 0 :(得分:0)

好的解决了它,最后很容易。由于我在服务器上工作并依赖安装在该服务器上的R版本,因此我没有意识到如何更新R本身。现在我明白了它似乎工作。感谢大家的帮助!这个已经解决了!