dm icon indicating copy to clipboard operation
dm copied to clipboard

Cheat sheet

Open moodymudskipper opened this issue 2 years ago • 23 comments

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 ?

moodymudskipper avatar May 10 '22 10:05 moodymudskipper

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 avatar May 10 '22 11:05 krlmlr

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

krlmlr avatar Jun 06 '22 03:06 krlmlr

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 avatar Jun 13 '22 06:06 maelle

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: ).

maelle avatar Jun 13 '22 06:06 maelle

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

krlmlr avatar Jun 13 '22 08:06 krlmlr

#1069 is actually related

  • the RStudio cheatsheets feature logos
  • a logo is another thing to print :grin:

maelle avatar Jun 13 '22 12:06 maelle

  • [ ] 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)

maelle avatar Jun 13 '22 12:06 maelle

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

maelle avatar Jun 13 '22 12:06 maelle

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

maelle avatar Jun 13 '22 12:06 maelle

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?

maelle avatar Jun 13 '22 12:06 maelle

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

maelle avatar Jun 13 '22 13:06 maelle

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 avatar Jun 13 '22 13:06 krlmlr

I think we have enough content for two-sided?

krlmlr avatar Jun 13 '22 13:06 krlmlr

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?

krlmlr avatar Jun 13 '22 13:06 krlmlr

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

maelle avatar Jun 13 '22 13:06 maelle

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.

krlmlr avatar Jun 13 '22 13:06 krlmlr

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 avatar Jun 13 '22 13:06 maelle

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

Right, possibly.

maelle avatar Jun 13 '22 13:06 maelle

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.

maelle avatar Jun 13 '22 13:06 maelle

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.

moodymudskipper avatar Jun 20 '22 09:06 moodymudskipper

Good point!

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

maelle avatar Jun 20 '22 14:06 maelle

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 avatar Jun 21 '22 03:06 krlmlr

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

krlmlr avatar Jul 26 '22 20:07 krlmlr