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

Improvements needed in select facility #7330

Open rdstern opened 2 years ago

rdstern commented 2 years ago

The select facility is still "work in progress". I suggest certain improvements are needed, before the next version.

image

I think @shadrackkibet is already working on the fact that calculations do not work yet once a selection is in operation.
The calculate above shows another small problem. I am not sure quite why these variables are not available in the dialogue. They can be used, simply by typing, as shown.

Then, pressing Ok, gives an error.

I had forgotten that columns can be added with many other dialogues. So I get the same problem with the Prepare > Data Frame > Row Names/Numbers dialogue. I think this is the same thing, because it is adding a variable, so has to know where.

image

I hope this can be sorted soon.

lilyclements commented 2 years ago

@rdstern this bug is occurring from the add_columns_to_data function.

Namely, in the line private$data[[curr_col_name]] <- curr_col (This is currently line 659, but may not be after future merges!)

The issue is that a new column is added (or, in the case of rearranging, is rearranged) in the unselected data set. But is not added to the selected data set. This is because private$data adds a new column to the unselected "original" data set.

We want to add the new columns for both the unselected "original" data set (private$data), and for the selected data set (self$get_data_frame()).

The problem here is now that I can see how to do it for the unselected data, but not sure how to approach it for the selected data set.

Ivanluv commented 2 years ago

The problem here is now that I can see how to do it for the unselected data, but not sure how to approach it for the selected data set.

@lilyclements my understanding is that the selected data frame is displayed after applying the selection conditions on the original data frame, is this correct? if so since, currently, the new column is added in the unselected data set, could we reload the selected data frame with the added columns included?

lilyclements commented 2 years ago

@Ivanluv yes you are right, and that's a good question/point. Personally, I'm not sure what is the best solution - I'm glad Shadrack fixed this bug though!

@Ivanluv @rdstern what do you both think is best? If you add a new column into a selected data frame, should it become a part of the selected data frame set of columns? (I'm hoping this will be a trivial fix, but I am not as experienced in that bit of the R-Instat code)

rdstern commented 2 years ago

@Ivanluv @lilyclements I am hoping this issue has now been fixed. The (at least partial) solution by @shadrackkibet is to remove the select when doing the calculation/transformation (I hope) and then to re-apply the select afterwards. This has turned out to be quite a neat feature, as follows: a) If the select is variables a, b, c. and then you make d <- a+b+c, then d is not included after making the calculation. b) If the select is variables a, b, c & variables starting with d, then it will be included!