How to view the data in R-workspace in this scenario?

spark
sparklyr

#1

Introduction

1 Billion JSON data has been read successfully by using Sparklyr package. First, this data is flattened (un-nested) into deep sub-levels by using following code.

Note - data and code is given as below (if anyone want to reproduce and run the code)

Please visit the link - Code and answer

In above link, already got an answer about flattening (un-nesting of data). But I can not view the data in table format from R-workspace. That may be simple issue. But I find it little bit difficult. I am new here in R.

The R code mentioned in the link reads the data file and gives output in deep level un-nesting of data columns (separating by '--' between root column and sub-column). Though JSON data is un-nested but I can not view it from R-workspace.

Problem

I could not see the data in table format from R-workspace. How to use sdf_register() here to view the data in R-workspace. Any help would be appreciated.


#2

I have got the answer after trying it,

table_data = collect(tbl(sc, "flattened_example"))

In above way, Data is visible from R-workspace.