Giter VIP home page Giter VIP logo

cheatsheets's Introduction

Posit Cheatsheets

The cheatsheets make it easy to learn about and use some of our favorite packages. They are published in their respective PDF versions here: https://posit.co/resources/cheatsheets/, some are also available in the RStudio IDE under Help > Cheatsheets.

We are also starting to make some cheatsheets available in a more accessible, text-based HTML format. These are available at https://rstudio.github.io/cheatsheets/.

This repository contains the source files of the current, archived and translated versions.

The cheatsheets use the creative commons copyright. Please see the LICENSE document for more details.

Translations

If you wish to contribute to this effort by translating a cheatsheet, please feel free to use the source Keynote file. To submit a translation, please use a Pull Request via GitHub. See the contributing guidelines for more information.

HTML cheatsheets

If you wish to provide an HTML cheatsheet version, please create a Pull Request with a new .qmd file in the html/ directory of this repository. Use one of the existing qmd files there as a starting point/template. These should not be duplicates of the pdf versions - they should be text-based so they are more accessible to people with visual impairments. Use of images should be minimized, and any images should include appropriate alternative text.

Tips for making a new cheatsheet

Cheatsheets are not meant to be text or documentation! They are scannable visual aids that use layout and visual mnemonics to help people zoom to the functions they need. Think of cheatsheets as a quick reference, with the emphasis on quick. Here's an analogy:

A cheatsheet is more like a well-organized computer menu bar that leads you to a command than like a manual that documents each command.

Everything about your cheatsheet should be designed to lead users to essential information quickly. If you are summarizing the documentation manual, you are doing it wrong! Here are some tips to help you do it right:

Getting Started

  1. RStudio cheatsheets are hosted at https://github.com/rstudio/cheatsheets. You can submit new cheatsheets to the repository with a pull request. See the contributing guidelines for more information.

  2. The files keynotes/0-template.key and powerpoints/0-template.ppt are official templates that contain some helpful tips.

  3. You may find it easiest to create a new cheatsheet by duplicating the most recent Keynote / Powerpoint cheatsheet and then heavily editing it—that's what I do!

Process

Budget more time than you expect to make the sheets. So far, I've found this process to be the least time consuming:

  1. Identify which functions to include by reading the package web page and vignettes. I try to limit my cheatsheets to the essentials.

  2. Organize the functions into meaningful, self-explanatory groups. Each group should address a common problem or task.

  3. Think about how to visualize the purpose of each function. Visual mnemonics are easier to scan than text, which all looks the same.

  4. Think about what key mental models, definitions, or explanations the cheatsheet should contain in addition to the functions. Ideally, use these to explain the visualizations.

  5. Sketch out several possible layouts for the sheet. Take care to put the more basic and/or pre-requisite content above and to the left of other content. Try to keep related content on the same side of the page. often your final layout will itself be a "mental map" for the topic of the cheatsheet.

  6. Type out all of the explanations and function descriptions that you plan to include. Lay them out. Use placeholders for the visuals. Verify that everything fits. White space is very important. Use it to make the sheet scannable and to isolate content groups. Retain white space, even if it means smaller text.

  7. Make the visuals. They take the longest, so I save them for last or make them as I do step 6.

  8. Tweak until happy.

Visual Design

  1. Use the existing theme that you see in the cheatsheets. It is cohesive and black and white printer friendly.

  2. Choose a highlight color to use throughout your cheatsheet, and repeat this highlight color in the background of the top right corner. Ideally you could find a color that is different enough from the other cheatsheets that you can quickly tell yours apart when flipping through a booklet of cheatsheets.

  3. Use a second color sparingly or not at all to draw attention to where it is needed and to differentiate different groupings of content.

  4. Include lots of white space.

  5. Visually differentiate groups of content. Backgrounds, boxes, side bars, and headers are helpful here. It is very useful for the user to know immediately where one group of content begins and where one ends. Our "gradation headers" fail here, so think of better solutions if possible.

  6. Align things to guides, i.e. align things across the page. It helps define the white space and makes the cheat more orderly and professional.

  7. Make the text no smaller than ~10pt.

  8. If the letters are white on a colored background, make the font thicker - semibold or bold.

  9. Save bold text for simple, important statements, or to draw scanning eyes to important words, such as words that identify the topic discussed. Don't make an entire paragraph bold text.

Content

  1. Include a hex sticker, IDE screenshot, or other branding material. The cheatsheets have a second function as marketing material.

  2. Include a Creative Commons Copyright to make the sheet easy to share. You'll find one baked into every cheatsheet and the template.

  3. Be very concise - rely on diagrams where possible.

  4. Pay attention to the details! Your readers sure will... so be correct.

  5. If in doubt, leave it out. There is a documentation manual after all.

  6. Code comments inform, but fail to draw the readers attention. It is better to use arrows, speech bubbles, etc. for important information. If it is not important information, leave it out.

  7. Simple working examples are more helpful than documentation details. They meet the user at his or her pain points, demonstrating code, and reminding users how to run it, with the least context shifting.

  8. Add some concise text to help the user make sense of your sections and diagrams. Images are best, but readers need to be able to interpret them.

Summary

Your cheatsheet has two goals. First, to help users find essential information quickly, and second, to prevent confusion while doing the above. Your best strategy will be to limit the amount of information you put into the cheatsheet and to lay that information out intuitively and visually. This approach will make your cheatsheet equally useful as a teaching tool, programming tool, or marketing tool.

Cheatsheets fall squarely on the human-facing side of software design. They focus on human attention. What does that mean? When you write documentation, your job is to fill in all of the relevant details—that's a software facing job, you need to know the software to do it. You assume that interested humans will find their way to your details on their own (and understand them when they do!). When you make a cheatsheet, your job flips. You assume that the relevant details already exist in the documentation. Your job is to help interested humans find them and understand them. Your job is to guide the human's attention. Don't just write, design.

Website

This repo is deployed as a quarto website at https://rstudio.github.io/cheatsheets/. It uses renv to manage the dependencies to render the site (in particular the html/*.qmd files that generate the HTML cheatsheets). Packages that are required to render these cheatsheets should be list in DESCRIPTION so that they are reliably discovered by renv::snapshot().

We prefer the Quarto cheatsheets to set eval: true and output: false in the execute options (vs eval: false) as this helps to ensure the code in them still works when they are rerun. Exceptions can be made on a per-chunk basis, and some (e.g., keras) are not really feasible to run all the time due to complex installation.

cheatsheets's People

Contributors

abinashbunty avatar andrie avatar ateucher avatar averiperny avatar barcaroli avatar batpigandme avatar blairj09 avatar brendanjodowd avatar coforfe avatar cwickham avatar daniprina avatar dickoa avatar echasnovski avatar edgararuiz avatar epetrovski avatar fvd avatar garrettgman avatar javierluraschi avatar jlugarrancho avatar jtelleria avatar koenderks avatar mine-cetinkaya-rundel avatar mpelleau avatar nbarrowman avatar pbiecek avatar ramiromagno avatar rcarto avatar rivaquiroga avatar sebkrantz avatar stefan-mueller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cheatsheets's Issues

Bug: dplyr Cheatsheet - mad() Function

There is a mistake in the dplyr Cheatsheet (2nd Page), as the mad() R Function corresponds to the "Median of the Absolute Deviations from the Median" (Robust to Outliers).

help(mad)

And not the "Mean Absolute Deviation".

Users might be fooled by Interpretation.

Thank you.

Best,
Juan

tidyr separate example missing sep argument

The example for table3 is missing the sep argument to separate(table3, rate, into = c("cases", "pop")

should be separate(table3, rate, sep="/", into=c("cases", "pop"))

Same for separate_rows example

Update H2O Cheatsheet

I created a Pull Request for Updating the H2O Cheatsheets with fixes from H2O Team.

Juan

ggplot 2 cheatsheet hard to find

the cheat sheet for ggplot "data-visualization-2.1.pdf " doesn't contain ggplot in the title, which when searching for the package's name could be a bit confusing. rename cheat sheet file to 'ggplot2' or 'data-visualization-with-ggplot2-2.1.pdf'?

Host tidyverse cheatsheet thumbnails?

We're adding thumbnails of the cheat sheets to relevant tidyverse packages, and, in order to avoid increasing package size, @hadley suggested we might host them here.
See tidyverse/stringr#239 (comment)
Would you be amenable to that? If so, I can submit a PR with the images (possibly as a subfolder of /pngs, since that's their file format.

Thanks!

devtools cheatsheet typo

Just noticed a small typo in the devtools cheatsheet, 1st page down left corner

devtools::add_build_ignore() is actually
devtools::use_build_ignore()

the cheat sheets are great resource - thanks!

ggplot2 Cheat sheet

In the ggplot2 Cheat sheet (data-visalization-2.1.pdf), the ggplot2 "logo" in the upper right corner has a very low resolution compared to the rest of the pdf.

typo in replace_na in the data import sheet.

In the example code for replace_na() function is the last x2, after the named list, a typo?

image

It is my understanding that there is no third argument for replace_na(), and the function works fine without it?

dplyr cheatsheet - typo

Under the Logical and boolean operators to use with filter() section, it reads See ?base::logic, but it should read See ?base::Logic with an upper-case L in Logic.
dplyr_logic

Update Package Development cheatsheet to use usethis

Switch out devtools::use_*() with usethis::use_*()

Then a few places that could mention another function:

  • Setup usethis::use_description()
  • Write Code Create a new code file with usethis::use_r()
  • Test Create a new test file with usethis::use_test()

data-wrangling-cheatsheet

Hello,
Data-wrangling cheatsheet is a fantastic every-day used tool ! Congrat !
You could maybe enhance it in adding

  1. Within Summarize data, info on summarise_all summarise_at and summarise_if commands that I found usefull to know
  2. Within Combine data sets, info on syntax to join by different column names , by=c("x1"="X1") that I often need to use

Modernization of the Sparklyr Cheatsheet

The Sparklyr Cheatsheet was compiled for sparklyr 0.5 and the current release is 0.9.3. Here are some of the notable issues:

  1. In the minimal local example:

screen shot 2018-12-07 at 12 22 39 pm

  • The following function: sdf_predict(model_iris, test_iris)
  • Should be updated to: sdf_predict(test_iris, model_iris)
  • Console warning message: The signature sdf_predict(model, dataset) is deprecated and will be removed in a future version. Use sdf_predict(dataset, model) or ml_predict(model, dataset) instead.
  1. IDE Integration Screenshot:

screen shot 2018-12-07 at 12 34 04 pm

  • What used to be the spark pane is now the connections pane in the RStudio IDE
  1. Data Load/Source options with Spark and R:

screen shot 2018-12-07 at 12 36 06 pm

This workflow that appears at the very top of the cheatsheet implies a troubling workflow in that it shows the data source starting in R. While that is a valid option, it really doesn't communicate that we know the power of connecting to data sources and working with big data and Spark.

I like this graphic that was used in the 0.6 webinar series by Edgar and Javier:
screen shot 2018-12-07 at 12 43 50 pm

Or this one that shows two different data source paradigms:
screen shot 2018-12-07 at 12 45 22 pm

  1. The graphic on the back page on the bottom right side has been updated to the following (available on spark.rstudio.com):

screen shot 2018-12-07 at 12 46 47 pm


I have not done a pass over the entire document. These are just a few things I've noticed this week

sparklyr cheatsheet

Is "SAVE FROM SPARK TO FILE SYSTEM" right?

SAVE FROM SPARK TO FILE SYSTEM
Arguments that apply to all functions: x, path
CSV spark_read_csv (header = TRUE, delimiter = ",", quote = """, escape = "\", charset = "UTF-8", null_value = NULL)
JSON spark_read_json (mode = NULL)
PARQUET spark_read_parquet (mode = NULL)

spark_read_[]?

Add "start" functions to sf cheatsheet

During workshop about geospatial data handling via sf, I gave the sf cheatsheet to participants: it was very useful, thanks for it. It also triggered some ideas for improvement.

We started by reading some .shp files, so we had to use the function st_read() which is not in the cheatsheet. However, loading shape files (.geojson, .shp, ...) in a R session is a quite common and standard operation in geospatial data handling.

Another quite common function to start working with geospatial data is st_as_sf() in order to add geometry to a data.frame by passing the CRS and the columns to use for making a geometry.

What do you think about adding a section in the cheatsheet on how to import geospatial data? Thanks.

visualizing the error that is Texas?

Front page of the ggplot2 cheatsheet, lower right, the heading for the maps section is incorrect... but maybe it's intended as a political statement. :-D

dplyr cheatsheet suggestion for summarizing NA not working

Under the "Summary Functions" heading and the "Counts" subheading, it lists:
sum(!is.na()) - # of non-NA's

However, using the following:
summarise(mtcars, notna = sum(!is.na()))

Produces this error:

#> Error in summarise_impl(.data, dots) : 
#> Evaluation error: 0 arguments passed to 'is.na' which requires 1.

lubridate cheatsheet

Will there be in the near future a "lubridate" cheatsheet?

It would be greatly appreciated, just as was stringr cheatsheet.

Thank you,
Juan

Proposed spelling correction to the README

Hi All,

would you please consider the correction below?


diff --git a/README.md b/README.md
index 0c176cb..446fef2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,3 @@
-
 ## RStudio Cheat Sheets
 
 <img src="pngs/rstudio-ide.png" width=364 height=288 align="right"/>
@@ -15,7 +14,7 @@ If you wish to contribute to this effort by translating a cht 
sheet, please fe                                                               
 
 ## Tips for making a new cheat sheet
 
-Keep these tips in mind when creating a new cheet sheat:
+Keep these tips in mind when creating a new cheat sheet:
 
 1. RStudio cheat sheets are hosted at https://github.com/rstudio/cheatsheets.ou
 can submit new cheat sheets to the repository with a pull request.            
 

sf cheatsheet: error in st_point

Thank you for making this cheatsheet - very valuable! I just noticed a typo in the assignment of x st_point.

It should be
st_point(x = c(numeric vector), dim = "XYZ"), not
st_point(x, c(numeric vector), dim = "XYZ").

stringr: str_c

In the stringr cheasheet, str_c function, it says:

str_c(..., sep = "", collapse = NULL) Collapse a vector of strings into a single string.

But the code it's exactly the same as in the paragraph above ('str_c(..., sep = "", collapse = NULL)').

The code should probably be:

str_c(..., sep = "", collapse = "")

Include package names in title

Ex. If I want to know how to use tidyr it's not obvious the cheatsheet I need is (the back of) data-import.pdf (and not say data-transformation.pdf)

lubridate cheatsheet: typo in INTERVALS

Current text reads:

INTERVALS
Divide an interval by a duration to determine its physical length, divide and interval by a period to determine its implied length in clock time.

There is a typo in the second "divide": from "..., divide and ..." to "..., divide an ..."

sf cheatsheat: error in st_contains

The description of the arguments is incorrect.

It says:

st_contains(x, y, ... ) identifies if x is within y (i.e. point within a polygon).

However, it should be the reverse. It identifies if y is within x.

Example:
ggplot() + geom_sf(data = test_polygon, alpha = 0.5, fill = "green") + geom_sf(data = my_point, size = 10)

st_contains

st_contains(x = my_point, y = test_polygon, sparse = FALSE)
[,1]
[1,] FALSE

st_contains(x = test_polygon, y = my_point, sparse = FALSE)
[,1]
[1,] TRUE

tidyr unite table figure misleading

The example of table5 joins to columns century and year. But if year is integer 0 or string "0" like in the picture then the result is "200" not "2000". You either need further string operations to convert integer 0 to string 00 or some kind of padding. In any case year should show up as "00".

I think it's not a good example because the "proper" way to do it would be 100*century + year. Better example would be like first and last name.

ggplot2 cheat sheet geom_curve example doesn't work

The geom_curve example (b + geom_curve(aes(...)) doesn't work because curvature is assigned to nonexistent z, replacing with a scalar number fixed it, or even defaults.. Older versions had different code that works.

It also sort of implies curvature could vary and @thomasp85 implies in a closed issue that it couldn't be implemented

Font issue when opening file

Trying to open both the keynote and the powerpoint, the font don't seem to work (small things like folder icon). Are the files using font awesome? IF yes, are you using a particular version?

Typo in Regex cheatsheat

In the regex cheatsheet, there's a typo. ignore.cases should be ignore.case.

I see that the regex cheatsheet is a PowerPoint file. If the easiest way to fix this is for me to download it, make the change, and reupload as a pull request, please let me know.

Thanks, and thanks for creating these great references!

Jake

new template format

There are two official templates formats: key for osx users and ppt for windows users.
Is there a chance to add another format that would be more linux/open source friendly?

dplyr cs: combine tables. by = "col1"

I think on the dplyr cheatsheet, column "Combine Tables", third but last 'bullet point' it should say by = "col1" instead of by = c("col1", "col2") – even though the latter seems to work to my surprise:
band_members %>% inner_join(band_instruments, by = c("name", "name"))

Also, from the commits I'd guess that the current one has been updated in 2018-03, not 2017-03 (re: footnote)

Layout error in RMarkdown sheet

Hi.

Found a tiny error in the RMarkdown sheet. A newline is missing from the "Customize output with sub-options" section, html_document: should be on the next line.

image

Possibly incorrect ensym usage in tidyeval cheat sheet

In the tidyeval cheasheet, in the "PASS TO ARGUMENT NAMES
OF A QUOTING FUNCTION" section on page 2, the example includes an objected named "name" that doesn't appear anywhere before it is used (in summarise(!!name := mean(!!var)). I think that the line of code above it (var <- rlang::ensym(var)) should probably be name<- rlang::ensym(name), that there should an argument passed to the function called name, and that there should be a var <- rlang::enquo(var) line (like in the "PROGRAM WITH A QUOTING FUNCTION" section example). I may be incorrect, but, in any matter, it seems unclear to me.

In all, I think it should look like this:

named_mean <- function(data, var, name) {
  require(dplyr)
  name <- rlang::ensym(name
  var <- rlang::enquo(var)
  data %>% 
    summarise(!!name := mean(!!var))
}

ggplot three variables code should have newline

Currently it's very hard to read

seals$z <- with(seals, sqrt(delta_long^2 + delta_lat^2))l <- ggplot(seals, aes(long, lat))

Also the example is contrived. Why not use a variable that makes sense like z = pop_density instead of whatever delta lat/long calculation is done?

@garrettgman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.