When I run this in Revolution R Enterprise, it totally crashes Rstudio on the last line:
require(RevoScaleR)
set.seed(1)
a = sample(c("happy", "sad", "other", NA), 100, replace = TRUE)
y = data.frame(a)
y$a = as.character(y$a)
rxCrossTabs(1 ~ a, data = y)
This seems buggy to me. Shouldn't it at least throw a warning and return me the command prompt?
The quick fix above is to simply exclude the line y$a = as.character(y$a)
, but I'd rather really understand what is going on. I'm having the same sort of crash with rxCrossTabs
when I try to run it on a .xdf
file, and I wonder if it is a related issue. I.e., perhaps somehow R is reading in a column of the file as character only instead of as factor, but I'm not sure how to investigate that directly.
This is not a Revolution R
problem; it's an Rstudio
problem. If I run your code in R
in a terminal session, it does not crash, but it does throw an error message that Rstudio
should have relayed to you:
Evidently your challenge now is to figure out how to put the right variable type on each column of interest in your .xdf file. Specifically, you need to have a factor
variable to use the rxCrossTabs
function.