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

Improve the position control in various dialogues #6080

Open rdstern opened 4 years ago

rdstern commented 4 years ago

a) This can start with the calculator. The Save Result control (which now has the position button added) I thought used to be a pull-down, so it was easy to choose the existing variables. If so, it has gone now. Please could it be either put back of put there if it wasn't ever there before. To see what is needed see, for example Prepare > Check > Duplicates where there is the pull-down. That is what we should have consistently. I am sure @Patowhiz can help if you have problems.

b) Also do the same with Prepare > Check Data > Duplicates. On that dialogue in addition:

1) Make the save control smaller, so it doesn't overlap with the text.
2) Add the pull-down
3) When the Save option is unticked the Position button should not be visible

c) Prepare > Check Data > Non-Numeric Cases - just the control d) Prepare > Column: Calculate > Enter e) Prepare > Column: Calculate > Duplicate (Notice all the other dialogues in Prepare > Column: Calculate menu are ok.) f) Prepare > Column: Factor > Count in Factor g) Prepare > Column: Factor > Combine Factor h) Prepare > Column: Text > Find/Replace - I think it is the same control for each of the top buttons? i) Prepare > Column: Text > Transform all options j) Prepare > Column: Text > Split

1) Save Control
2) Change the size of the position, which is larger here.

k) Prepare > Column: Text > Combine l) Prepare > Column: Text > Distance m) Also Climatic > Prepare > Transform I hope this will be simple, but feel free to break this into a number of issues if you wish

(Added on 24 Dec 2020 - Some of these have now been done. However, I suggest the control is still not quite what is wanted. We could like the save control to also be a pull-down, so the existing variables could be chosen easily and overwritten. As mentioned in bold above see the Prepare > Check Data > Duplicates where this has been done.)

Also note and very important, the extra point added by Danny below, that for the Prepare > Calculator dialogue the Save should have a checkbox and be optional. And for the Prepare > Column: Text > Split dialogue the Position button remains too large.

And I have added a request below for the Climatic > Prepare > Transform dialogue to have the same changes - and also to be made smaller!)

dannyparsons commented 4 years ago

There is also a serious issue in the Calculator. It used to have a checkbox in the save control will allows for saving or not saving the column. If not saving the result is printed only. This option has been removed. Can it be added back as part of this work?

Wycklife commented 4 years ago

@dannyparsons I'm including that change

Wycklife commented 4 years ago

@rdstern I have looked and the dialogs mentioned above, and non of the has the ticked/unticked option, did you therefore mean that, that option should be added in all the above dialogs? Kindly clarify no. 3 above.

rdstern commented 4 years ago

@Wycklife the confusion could be the poor formatting of my original message. Se if it is clear now.

rdstern commented 3 years ago

There is also the same issue in the Climatic > Prepare > Transform dialogue, i.e. to add the Position button. Also to make the default position to be just after that variable specified in the dialogue. At the same time, that dialogue looks poor, simply because of the width of the radio buttons. There is a lot of unnecessary blank space at the right of the dialogue. Please could the buttons be made smaller - perhaps even slightly of unequal size - so this does not occur.

Patowhiz commented 3 years ago

There is also a serious issue in the Calculator. It used to have a checkbox in the save control will allows for saving or not saving the column. If not saving the result is printed only. This option has been removed. Can it be added back as part of this work?

I noticed the event listened by the Prepare > Calculator dialog for this functionality was not being raised. I've added the implementation. So this should also work for any other dialog using ucrCalculator

Patowhiz commented 3 years ago

@rdstern I've been looking at Climatic > Prepare > Transform Below is the script code that produces the column.

# Code generated by the dialog, Transform

group_by_year <- instat_calculation$new(type="by", result_name="group_by_year", calculated_from=list("Dodoma"="Year"))
transform_calculation <- instat_calculation$new(type="calculation", function_exp="cumsum(Rain)", result_name="cumsum", calculated_from=list("Dodoma"="Rain"), manipulations=list(group_by_year), save=2)
data_book$run_instat_calculation(calc=transform_calculation, display=FALSE)
rm(list=c("transform_calculation", "group_by_year"))

The above script code is different in sequence of events compared to other dialogs. Inside instat_calculation$new function is where the new column (result_name="cumsum") is produced. To make this dialog use the ucrSave control, we could either;

  1. Extend the instat_calculation$new R function to accept parameters for positioning the column, since it internally calls the R function that produces the column.
  2. Or add an after code R script that gets the new column and changes its position.

This may require @dannyparsons suggestion on what is the most preferred option.

rdstern commented 3 years ago

@Patowhiz you are correct to query why we need a checkbox for the Prepare > Check > Duplicates. Keep it as it is now. However, on the Duplicates could you add the summary command just the same as it is for Prepare > Check Data > Non-numeric This is the line that says something like:

summary(object=data_book$get_columns_from_data(data_name="survey", col_names="dup2"))

It is nice that there is a result, and this is also a useful one!

And, while I was checking that, I noticed that in the non-num dialogue: a) on the negative side: there is an odd space, before the field to save the variable b) on the positive side: the size and positioning of the Position button look neat there. You must have found a way to do that. I wonder about that button elsewhere?

I just also record a problem I keep finding - which has been solved - but we must be patient. In the Prepare > Calculations > Enter dialogue the Try gives an error when used with a single number or text. @Patowhiz found this should be solved automatically when R advances to version 4.1 - see the closed issue #6018.

dannyparsons commented 3 years ago

The above script code is different in sequence of events compared to other dialogs. Inside instat_calculation$new function is where the new column (result_name="cumsum") is produced. To make this dialog use the ucrSave control, we could either;

  1. Extend the instat_calculation$new R function to accept parameters for positioning the column, since it internally calls the R function that produces the column.
  2. Or add an after code R script that gets the new column and changes its position.

We should do this with option 1., which will make it easy from the front-end side since it can have the same position parameters as DataBook$add_columns_to_data. When implementing this in instat_calculation$new need to remember that an instat_calculation is very general, it may result in a new data frame/summary, subset, column or columns, so position will not make sense in some cases. For specific dialogs, such as Transform, this isn't a problem, as it always produces a single new column in an existing data frame, but we need to ensure it doesn't break other uses of instat_calculation

Patowhiz commented 3 years ago

@Patowhiz you are correct to query why we need a checkbox for the Prepare > Check > Duplicates. Keep it as it is now. However, on the Duplicates could you add the summary command just the same as it is for Prepare > Check Data > Non-numeric This is the line that says something like:

summary(object=data_book$get_columns_from_data(data_name="survey", col_names="dup2"))

It is nice that there is a result, and this is also a useful one!

And, while I was checking that, I noticed that in the non-num dialogue: a) on the negative side: there is an odd space, before the field to save the variable b) on the positive side: the size and positioning of the Position button look neat there. You must have found a way to do that. I wonder about that button elsewhere?

I just also record a problem I keep finding - which has been solved - but we must be patient. In the Prepare > Calculations > Enter dialogue the Try gives an error when used with a single number or text. @Patowhiz found this should be solved automatically when R advances to version 4.1 - see the closed issue #6018.

@rdstern I have separated the addition of summary command in a separate issue #6239 to ease reviewing. So I will do that in a separate PR.

Will do the duplicates dialog and item (a) mentioned above in PR #6232

Patowhiz commented 3 years ago

@rdstern I think this can now be closed. The items mentioned above have been fixed.

shadrackkibet commented 3 years ago

Perhaps this has been reported elsewhere/it was discussed. I think saving in Transform dialog doesn't work properly yet. For example

Patowhiz commented 3 years ago

@shadrackkibet thanks for pointing out that bug. I will have a look at it.

Patowhiz commented 3 years ago

Perhaps this has been reported elsewhere/it was discussed. I think saving in Transform dialog doesn't work properly yet. For example

  • The indexing for the save control doesn't work. A user can be overriding a column without knowing.
  • The save control doesn't retain the typed name. If I use a different name, close the dialog then reopen the previous name is lost.

@rdstern could you check the above issue reported by @shadrackkibet. I'm not sure if it was intentionally done that way.