Search code examples
rr-factorunorderedh2o

h2o (un) ordered factor


Hi I have a problem with the h2o(3) not loading my factors.

The Problem is similar to: Unable to convert data frame to h2o object

However I tried to use: myData<- data.frame(apply(myData, 2, factor, ordered=FALSE)) but the error persists: Provided column type c("ordered", "enum") is unknown.

Is there some other method to ensure that my factor is unordered?

edit

here a subset of the data

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

Solution

  • This:

    sapply(myData, class)
    

    prints the classes of each column and helps to identify the one which is causing the errors.

    I will exclude / convert that column manually.