IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 103 forks source link

Additions to the Use Table dialog #8339

Open lilyclements opened 1 year ago

lilyclements commented 1 year ago

From PR #8145 @rdstern makes the following request:

I would like us also to reflect on what else might be possible when we use a table. a) Could the Table to Use label be just Table. b) Could we have a table witout margins and add, or change the margins here? If so, then we could include the margins stuff from the main tables dialogue. c) Could we change the layout? If so, then we could add the layout controls from the main dialogue. d) If b) and c) then maybe each would start with the existing settings in the existing table?

I give my responses to b and c below - To b) - We can do adding margins if the table is a frequency table. But otherwise it is a little more complicated.
In order to add the margins, we need the raw data. This is because the margins are calculated from the data not the table itself. It may be possible to do this, if we saved the raw data and the table. But then if the user changed an aspect of the raw data before adding the margins, then the margins would not align up. Saving a snapshot of the entire raw data may not be the most efficient way either.

c - what sort of layout changes were you thinking?

rdstern commented 1 year ago

@lilyclements amd @anastasia-mbithe my reason for the questions above were to consider what we could add to the main part of the Use Table dialogue. In particular what do we have on the Tables dialogue, that could be adapted and also be on the Use Table dialogue.

I am not that keen on adding to the table object.

So, on b) you say we can fiddle with margins for a frequency table, but not for a summary table. So can we tell easily if a table is a frequency table, rather than a summary table?

And, for any table I assume we can drop margins?

Now frequency tables can have percentages. Can the percentages be changed (easily) in a Use Table dialogue. I am not wanting to get clever here, just wanting to know what's easy.

So, on item c) on the layout is it easy to swap which factors are on the columns and which make up the rows of a table?

I realise this misn't a pivot table, where we could easily drop a factor, so make a 3-way table into a 2-way one.

If I think in ggplot terms then there is a lot we can do around the numbers of the table - themes sort of stuff, etc. I am happy if you tell me that's all - it is well defined after all. Then it is just our format stuff, which we have already. I am interested to know if we can do more.

If not, then we just continue with the work on the Format stuff and (later) check if some popular items from there could be repeated on the main Use Table dialogue, e.g. Title.

lilyclements commented 1 year ago

@rdstern

So, on b) you say we can fiddle with margins for a frequency table, but not for a summary table. So can we tell easily if a table is a frequency table, rather than a summary table?

This is a good point - we don't actually have a way to tell the two types of tables apart, no. It's not impossible to have the option to add table margins later, if we save the "data frame at time of table creation" to refer back to when adding margins. I think for now this is a bit too much.

And, for any table I assume we can drop margins? We can drop any column or row on any table, and margins are just another column, or row. The difficulty will be in knowing the name of the margins - we don't have a distinction between the margins and another row or column of data. But we can offer the ability to drop margins by just offering to drop any row or column if they specify which?

Now frequency tables can have percentages. Can the percentages be changed (easily) in a Use Table dialogue. I am not wanting to get clever here, just wanting to know what's easy.

I would guess not.

Once these calculations are made, the are then separate from the data. This table is not linked to the data, which means that we cannot make recalculations after the table has been made - such as adding margins, or changing percentages.

So, on item c) on the layout is it easy to swap which factors are on the columns and which make up the rows of a table?

This is related to the layout of the table, so this is very easy and straight forward to do. This is just the same as pivot_wider or pivot_longer, say. But, you're right that it isn't the same as a pivot table, so we can't "recalculate" anything.