h2o (un) 有序因子
h2o (un) ordered factor
嗨,我有一个问题,h2o(3) 没有加载我的因子。
问题类似于:Unable to convert data frame to h2o object
但是我尝试使用:myData<- data.frame(apply(myData, 2, factor, ordered=FALSE))
但错误仍然存在:Provided column type c("ordered", "enum") is unknown.
有没有其他方法可以确保我的 factor
是 unordered
?
编辑
这里是数据的一个子集
dput(droplevels(head(myData[1:5])))
structure(list(Id = structure(1:6, .Label = c(" 2", " 5",
" 6", " 7", " 8", " 10"), class = "factor"), factor1 = structure(c(1L,
1L, 1L, 1L, 1L, 1L), .Label = "1", class = "factor"), factor2 = structure(c(3L,
1L, 5L, 4L, 2L, 2L), .Label = c("A1", "D2", "D3", "D4", "E1"), class = "factor"),
factor3 = structure(c(1L, 2L, 2L, 1L, 2L, 2L), .Label = c("10",
"26"), class = "factor"), factor5 = structure(c(1L,
1L, 1L, 1L, 1L, 2L), .Label = c("2", "3"), class = "factor")), .Names = c("Id",
"factor1", "factor2", "factor3", "factor5"
), row.names = c(NA, 6L), class = "data.frame")
> head(myData[1:5])
Id factor1 factor2 factor3 factor5
1 2 1 D3 10 2
2 5 1 A1 26 2
3 6 1 E1 26 2
4 7 1 D4 10 2
5 8 1 D2 26 2
6 10 1 D2 26 3
这个:
sapply(myData, class)
打印每一列的 类 并帮助识别导致错误的列。
我将手动排除/转换该列。
嗨,我有一个问题,h2o(3) 没有加载我的因子。
问题类似于:Unable to convert data frame to h2o object
但是我尝试使用:myData<- data.frame(apply(myData, 2, factor, ordered=FALSE))
但错误仍然存在:Provided column type c("ordered", "enum") is unknown.
有没有其他方法可以确保我的 factor
是 unordered
?
编辑
这里是数据的一个子集
dput(droplevels(head(myData[1:5])))
structure(list(Id = structure(1:6, .Label = c(" 2", " 5",
" 6", " 7", " 8", " 10"), class = "factor"), factor1 = structure(c(1L,
1L, 1L, 1L, 1L, 1L), .Label = "1", class = "factor"), factor2 = structure(c(3L,
1L, 5L, 4L, 2L, 2L), .Label = c("A1", "D2", "D3", "D4", "E1"), class = "factor"),
factor3 = structure(c(1L, 2L, 2L, 1L, 2L, 2L), .Label = c("10",
"26"), class = "factor"), factor5 = structure(c(1L,
1L, 1L, 1L, 1L, 2L), .Label = c("2", "3"), class = "factor")), .Names = c("Id",
"factor1", "factor2", "factor3", "factor5"
), row.names = c(NA, 6L), class = "data.frame")
> head(myData[1:5])
Id factor1 factor2 factor3 factor5
1 2 1 D3 10 2
2 5 1 A1 26 2
3 6 1 E1 26 2
4 7 1 D4 10 2
5 8 1 D2 26 2
6 10 1 D2 26 3
这个:
sapply(myData, class)
打印每一列的 类 并帮助识别导致错误的列。
我将手动排除/转换该列。