I want to perform method:
as.data.frame.matrix(xtabs(~name + value, table))
In Rstudio on data.frame objects it works quite cool. I have a data.frame 'table' as follows:
> table
name value
[1,] "user1" "less"
[2,] "user1" "more"
[3,] "user1" "agua"
[4,] "user1" "dog"
[5,] "user2" "less"
[6,] "user2" "agua"
[7,] "user2" "dog"
Performing: ans <- as.data.frame.matrix(xtabs(~name+value, table))
I have obtained result as follow:
> ans
agua dog less more
user1 1 1 1 1
user2 1 1 1 0
Do you know how can I get same result on SparkR basing on Formal DataFrame object, not on data.frame?
You cannot. Spark DataFrame
is not compatible with standard R functions and cannot be used to replace data.frame
.