explore icon indicating copy to clipboard operation
explore copied to clipboard

Can explore_all() function allow more than 1 single target= variable?

Open sfd99 opened this issue 2 years ago • 5 comments

Hi Roland,

Thanks for the update to the GREAT explore PKG.

Your work and dedication is wonderful work (as always...) ! .

Q: Can the explore_all() function allow more than 1 single target variable?. ie: instances COMBINING 2 target vars at the same time...

EX: penguins %>% explore_all( target = species AND island )

The output report / plots would show (for ex), the density plot of variable: body_mass_g , for penguins species: "Adelie" also living in island: "Dream"...

I can see applications of explore_all(), where allowing MORE THAN 1 single var as the target= would be VERY powerful for analysis.

sfd99 San Francisco explore PKG 1.1.0 Ubuntu Linux 20.04, latest Rstudio and R.

sfd99 avatar Oct 15 '23 15:10 sfd99

Interesting, I never thought about this.

I see cases (and I had them by myself) that exploring data using 2 or more targets is useful.

In this cases I simply call explore() or report() with each target.

You could even create your own notebook using create_notebook_explore() and then copy paste the target section and adding a new target. So you would have both targets in one HTML report.

rolkra avatar Oct 15 '23 16:10 rolkra

Ah, yes... I see your point.

But this would still consider the 2 targets individually. (not combined into a single target).

But it would be powerful to see one density plot only, ie: value distribution for body_mass_g for a combined target: "Adelie" pengs AND only living in "Dream" island.

If you develop the idea, let me know and I'll help test it. :-)

Anyhow, hope you are having a nice weekend in wonderful Wien. :-)

sfd99 avatar Oct 15 '23 17:10 sfd99

Hmmm You could define a new target variable

library(tidyverse) library(explore) data <- use_data_penguins() data <- data |> mutate(adelie_dream = ifelse(species == "Adelie" & island == "Dream", 1, 0)) data |> explore_all(target = adelie_dream) data |> select(-species, -island) |> explain_tree(target = adelie_dream)

rolkra avatar Oct 16 '23 11:10 rolkra

Wow Roland, excellent thinking.

  • and on a Monday morning, too! ... :-)

Works great !.

I wonder if there is a way to integrate this combined " several-Target= columns at once " feature, into the already fantastic explore PKG ?.

think about it...

sfd99 avatar Oct 16 '23 13:10 sfd99

Yes, I guess the new feature would be that explore() function accepts as target a variable OR an logical expression (that returns 0/1 and this is automatically the target) Thanks!

rolkra avatar Oct 16 '23 13:10 rolkra