dm
dm copied to clipboard
Cheat sheet
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 ?
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.
This is a major undertaking, but would make very pretty handouts. Let's see if we can squeeze it in.
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)
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: ).
Should we do a list of actionable items and perhaps deadlines?
#1069 is actually related
- the RStudio cheatsheets feature logos
- a logo is another thing to print :grin:
- [ ] Create cheatsheet title (Data "blablabla" with dm) EOD 2022-06-20
- [ ] Create section titles EOD 2022-06-20
- [ ] Fill said sections EOD 2022-06-20
- [ ] Draw little diagrams
- [ ] Create layout (hire specialist? create a Bootstrap template for printable HTML?)
- [ ] Print (:warning: paper size)
Hey mlr has HTML cheatsheets https://github.com/mlr-org/mlr3cheatsheets/blob/main/mlr3fselect/mlr3fselect.Rmd
@krlmlr @moodymudskipper do you have a one-sided or two-sided cheatsheet in mind?
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
- from database
- from data frames
- add keys (functions for adding & enum)
Visualize dm
including colors (well one example)
Check dm
Page 2
Transform dm
select, filter zoom
Save dm
how to persist changes
Make tibble
- flatten
- wrap?
Use nycflights13 data, with small icons to decorate & easily identify each table? E.g. a plane for the airplane table.
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.
I think we have enough content for two-sided?
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?
by "icons" I meant small drawings
- for flights like the "dashboards" that are in airports
- for planes, well, 2-3 planes
- for airports, a small building
- for airlines, a stewart/pilot
- for weather, cloudy sun
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.
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)
I like the idea, but won't the icons be too small in the end?
Right, possibly.
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.
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.
Good point!
I might start by drawing diagrams by hand then recreate them by code. :thinking:
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?)
Keeping it open because we still want to put it online, as a pkgdown article?