Hi I have a deeply nested json file. I used sparklyr to read this json file and called this "data" object.
Firstly I will show what the data structure looks like:
# Database: spark_connection
data
-a : string
-b : string
-c : (struct)
c1 : string
c2 : (struct)
c21: string
c22: string
Something like this. So if I extract "a" using:
data %>% sdf_select(a)
I can view what the data inside, like:
# Database: spark_connection
a
<chr>
1 Hello world
2 Stack overflow is epic
THE PROBLEM now comes is when i use sdf_select() a deeper structure i.e.
data %>% sdf_select(c.c2.c22)
Viewing the data inside, I get this
# Database: spark_connection
c22
<list>
1 <list [1]>
2 <list [1]>
3 <list [1]>
4 <lgl [1]>
so if I collect the data so that the spark data frame turns into R data frame and viewing the data using commands
View(collect(data %>% sdf_select(c.c2.c22)))
The data shows
1 list("Good")
2 list("Bad")
3 NA
How do I turn every entry in each list above to a data frame table so that it shows Good, Bad, NA only instead with list("") on it?