In SparkR I have a DataFrame data
. It contains time
, game
and id
.
head(data)
then gives ID = 1 4 1 1 215 985 ..., game
= 1 5 1 10 and time 2012-2-1, 2013-9-9, ...
Now game
contains a gametype which is numbers from 1 to 10.
For a given gametype I want to find the minimum time, meaning the first time this game has been played. For gametype 1 I do this
data1 <- filter(data, data$game == 1)
This new data contains all data for gametype 1. To find the minimum time I do this
g <- groupBy(data1, game$time)
first(arrange(g, desc(g$time)))
but this can't run in sparkR. It says "object of type S4 is not subsettable".
Game 1 has been played 2012-01-02, 2013-05-04, 2011-01-04,... I would like to find the minimum-time.