Skip to content

Conversation

averissimo
Copy link
Contributor

Pull Request

Fixes #558

Changes description

Adds tables to Show R code shown on screen for different modules

  • tm_g_distribution: simple "print" of existing table to qenv
  • tm_g_scatterplot.R: simple "print" of existing table to qenv
  • tm_outliers.R
    • Complex change that adds an extended data frame enriched with additional columns shown in table
      • Solution doesn't keep repetitive code
      • Keeps previous workflow as much as it can
    • Possible alternative solution (easier)
      • This would just print the ANL_OUTLIERS that only has 6 columns

How to test

  • Run locally the exploratory application of teal.gallery
  • Open the modules and test the module while observing/running the Show R code
  • Brush selection to see if previous behaviour is kept
    • Filters the table, but not the code
    • Adding selected columns in Outliers table won't deselect the data points selection

@averissimo averissimo added bug Something isn't working core labels Aug 11, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2023

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  ----------------------------------------------
R/tm_a_pca.R                    828     828  0.00%    72-1024
R/tm_a_regression.R             714     714  0.00%    92-889
R/tm_data_table.R               171     171  0.00%    58-281
R/tm_file_viewer.R              172     172  0.00%    39-241
R/tm_front_page.R               127     116  8.66%    63-205
R/tm_g_association.R            331     331  0.00%    89-478
R/tm_g_bivariate.R              653     493  24.50%   124-703, 751, 757, 761, 872, 889, 907, 927-949
R/tm_g_distribution.R          1026    1026  0.00%    110-1258
R/tm_g_response.R               347     347  0.00%    85-496
R/tm_g_scatterplot.R            717     717  0.00%    160-968
R/tm_g_scatterplotmatrix.R      278     259  6.83%    78-373, 427, 441
R/tm_missing_data.R            1039    1039  0.00%    58-1234
R/tm_outliers.R                 974     974  0.00%    76-1180
R/tm_t_crosstable.R             252     252  0.00%    81-371
R/tm_variable_browser.R         822     817  0.61%    61-1311
R/utils.R                       122     122  0.00%    74-351
R/zzz.R                           1       1  0.00%    2
TOTAL                          8574    8379  2.27%

Diff against main

Filename                 Stmts    Miss  Cover
---------------------  -------  ------  --------
R/tm_g_distribution.R       +1      +1  +100.00%
R/tm_g_scatterplot.R        +1      +1  +100.00%
R/tm_outliers.R            +32     +32  +100.00%
TOTAL                      +34     +34  -0.01%

Results for commit: 72ba9c9

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2023

Unit Tests Summary

  1 files    5 suites   0s ⏱️
16 tests 16 ✔️ 0 💤 0
49 runs  49 ✔️ 0 💤 0

Results for commit e580250.

♻️ This comment has been updated with latest results.

@kartikeyakirar
Copy link
Contributor

Hi @averissimo, just wanted to let you know that you can find useful tips on naming conventions for stage dependencies at this link: GitHub Naming Conventions. When you use a branch name like "print_tables_show_r_code@main," the staged.dependencies tool will check branches in other repositories.

R/tm_outliers.R Outdated
)
) %>%
# used to display table when running show-r-code code
teal.code::eval_code(quote(ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, ]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, ]Show all columns in the dataset, including those not displayed on the dashboard.

I believe that the code should print a table that displays on the dashboard, as well as any user-selected columns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kartikeyakirar this may have a UX side effect as any change to the columns being selected will clear the selected data points.

My suggestion is to add the outlier table print after the plot call, otherwise, any column change will trigger reactivity in the <plot>_q and re-render the plot.

The downside is that this approach requires duplicate code only (column selection)

image

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show all columns in the dataset, including those not displayed on the dashboard.

this problem is fixed. I can see table displayed on dashboard.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any change to the columns being selected will clear the selected data points.

I believe there's no necessity for us to proceed with this step, as we're unable print user selections within the ggplot. Thus, there's no need to gather the selected datapoints in reproducible code. In my opinion, doing so might lead to confusion when working with reproducible code. I'd appreciate your input on this, @cicdguy, particularly with regard to displaying datapoints from outlier selections in the plot.

Image to capture outlier points on table
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to @donyunardi or @gogonzo to voice their opinions on this. I don't think I'm qualified to speak to this 👨🏽‍🎓

Copy link
Contributor Author

@averissimo averissimo Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kartikeyakirar

any change to the columns being selected will clear the selected data points.

My statement wasn't super clear. This relates to the placement of the table-print code in qenv, as if we place the code for table-print before the plot-print, then it will add reactivity that re-renders the plot every time a column is selected/deselected (which causes all brushed selection being lost)

Hence, the table-print is located after the plot-print.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hence, the table-print is located after the plot-print.

The solution is looking good! Just wanted to mention that the placement of the table code seems alright in my opinion.

@averissimo averissimo force-pushed the print_tables_show_r_code branch from 20d4472 to 43ad79b Compare August 16, 2023 07:07
@kartikeyakirar
Copy link
Contributor

@averissimo can you make similar change to your PR to Pass GitHub checks. d711d17

@averissimo averissimo force-pushed the print_tables_show_r_code branch from d540cf1 to 77be5b3 Compare August 18, 2023 10:18
@kartikeyakirar
Copy link
Contributor

I believe there's no necessity for us to proceed with this step, as we're unable print user selections within the ggplot. Thus, there's no need to gather the selected datapoints in reproducible code. In my opinion, doing so might lead to confusion when working with reproducible code. I'd appreciate your input on this, @cicdguy, particularly with regard to displaying datapoints from outlier selections in the plot.

Hey @averissimo, I still have some concerns about this point. Could we add another task for discussion regarding this matter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DT tables are not printed in Show R code of different modules

3 participants