cynkra / dm

Working with relational data models in R
https://dm.cynkra.com
Other
497 stars 50 forks source link

Cheat sheet #996

Open moodymudskipper opened 2 years ago

moodymudskipper commented 2 years ago

I think dm is exactly the type of package that benefits from a cheat sheet.

The best ressource is probably : https://github.com/rstudio/cheatsheets , it provides templates and guidelines

Maybe a good project for an intern ?

krlmlr commented 2 years ago

Good idea! We can start with a sketch, what APIs and concepts to present in what order. I'd wait for dm >= 1.0.0 with the actual implementation.

krlmlr commented 2 years ago

This is a major undertaking, but would make very pretty handouts. Let's see if we can squeeze it in.

maelle commented 2 years ago

Accessibility note. Ideally a cheatsheet should also have an HTML output (for screen-reader users). Or even "only" https://twitter.com/DogGeneticsLLC/status/1486736866581876737 (could still be printable depending on how it's created)

maelle commented 2 years ago

I can't see a template with a quick search. I imagine an HTML template could be created with Bootstrap.

Maybe there should be a separate issue for this format comments (as opposed to "cheatsheet content" :sweat_smile: ).

krlmlr commented 2 years ago

Should we do a list of actionable items and perhaps deadlines?

maelle commented 2 years ago

1069 is actually related

maelle commented 2 years ago
maelle commented 2 years ago

Hey mlr has HTML cheatsheets https://github.com/mlr-org/mlr3cheatsheets/blob/main/mlr3fselect/mlr3fselect.Rmd

maelle commented 2 years ago

@krlmlr @moodymudskipper do you have a one-sided or two-sided cheatsheet in mind?

maelle commented 2 years ago

If two sided, current notes.


Page 1

Basics

(https://raw.githubusercontent.com/rstudio/cheatsheets/main/tsbox.pdf and https://raw.githubusercontent.com/rstudio/cheatsheets/main/tidyr.pdf have short intros)

A dm is a list of data frames capturing relationships between the tables. Diagram.

Create dm

Visualize dm

including colors (well one example)

Check dm


Page 2

Transform dm

select, filter zoom

Save dm

how to persist changes

Make tibble

maelle commented 2 years ago

Use nycflights13 data, with small icons to decorate & easily identify each table? E.g. a plane for the airplane table.

krlmlr commented 2 years ago

I can't think of good icons for the flights data, maybe colors would be good enough? We could think about coloring airports differently, because of the parallel edges with cycle = TRUE .

The pixarfilms dataset is also interesting, it has items (the films) with detailed information.

krlmlr commented 2 years ago

I think we have enough content for two-sided?

krlmlr commented 2 years ago

Page 2 -- transform and "make tibble" are related and could go side by side, with "save dm" taking the other half? Or 2+1+1?

maelle commented 2 years ago

by "icons" I meant small drawings

krlmlr commented 2 years ago

I like the idea, but won't the icons be too small in the end? Colors + icons are an option, of course. We can match the colors in dm_draw() with the colors of the icons.

maelle commented 2 years ago

Page 2 -- transform and "make tibble" are related and could go side by side, with "save dm" taking the other half? Or 2+1+1?

Indeed, and save dm could be below transform dm. If save dm does not take the lower half then the last cadran would be ??? (still thinking)

maelle commented 2 years ago

I like the idea, but won't the icons be too small in the end?

Right, possibly.

maelle commented 2 years ago

Btw for functions like the one adding keys I was imagining diagrams before / diagrams after like on https://raw.githubusercontent.com/rstudio/cheatsheets/main/tidyr.pdf

For instance seeing there is one more arrows after adding a forein key.

moodymudskipper commented 2 years ago

Yes diagrams before and after would help a lot, this is something the help files don't (can't ?) provide and is so much easier to understand than abstract text. With this approach we'll probably need a 2 sided cheat sheet because diagrams take space. The argument view_type = c("keys_only", "all", "title_only") can help to build minimal visualisations and we might also have color codes for before/after.

maelle commented 2 years ago

Good point!

I might start by drawing diagrams by hand then recreate them by code. :thinking:

krlmlr commented 2 years ago

Before-after views are shown in the rendered examples: https://cynkra.github.io/dm/reference/dm_add_pk.html . It's unfortunate that it's not shown in the local help view, but then the IDE could also redirect to the remote help if there's internet and if the location of the help file can be inferred. (Would a pkgdown page be displayed nicely in RStudio's help viewer?)

krlmlr commented 2 years ago

Keeping it open because we still want to put it online, as a pkgdown article?