I was trying to present results using rmarkdown document, and to use the crosstalk
package to show different part (columns of list of tibble) of the resulting tibble.
Here is a example result tibble
my_example
# A tibble: 9 x 4
Model_Index R.squared Result summary
<dbl> <dbl> <list> <list>
1 1 0.139 <tibble [5 x 5]> <tibble [6 x 7]>
2 2 0.137 <tibble [5 x 5]> <tibble [6 x 7]>
3 3 0.137 <tibble [5 x 5]> <tibble [6 x 7]>
4 4 0.105 <tibble [5 x 5]> <tibble [6 x 7]>
5 5 0.0678 <tibble [5 x 5]> <tibble [6 x 7]>
6 6 0.0677 <tibble [5 x 5]> <tibble [6 x 7]>
I have created the shared data-frame like object by sd <- SharedData$new(my.res)
successfully.
Then I'd like to implement is I can pick the model(s) index using filter_slider()
, then based on the selection, showing two tables bt DT()
, one for Result <tibble [5 x 5]>
column, one for summary <tibble [6 x 7]>
column.
I have tried put this pipe inside the DT()
like
datatable(sd$data() %>% select(Model_Index, Result) %>%
unnest(cols = c(Result)), extensions="Scroller",
style="bootstrap", class="compact", width="100%",
options=list(deferRender=TRUE, scrollY=300, scroller=TRUE))
```
Though it did not produce any error, but it gave all models in my results, no matter which models I selected.
Any help?
Thanks.