Base R Cheat Sheet for Vectors, Indexing and Data Frames
A Base R reference sheet covering objects, vectors, indexing, functions, data frames, missing values and basic plotting for learning and everyday analysis scripts.
What this reference covers
This Base R reference compresses common operations on objects, vectors, lists, matrices, data frames, factors, functions and basic plots into a searchable study path. It works best beside a small reproducible sample: look up a concept, run it, inspect the result and record the environment.
Check structure before interpretation
R's vectorization, recycling, coercion, factors and NA handling can create results that look plausible. Print type, length, names, dimensions and a summary after important transformations, and add simple assertions before a result is used downstream.
Turn lookup into a script
Start with objects and indexing, then combine functions, data frames and plots. Fix input path, encoding, random seed, R version and output format when a script must be shared or rerun. Keep package-specific syntax clearly separated from Base R.
Maintenance note
The sheet is a quick operation index rather than a full language, statistics or package manual. Data quality, R versions, package versions and environment settings affect results. Content review date: 2026-08-23.
Save to your cloud drive
Save the complete collection first so files remain together and are easier to access across devices.
Quark Cloud Drive
RecommendedSave Base R Cheat Sheet for Vectors, Indexing and Data Frames to this cloud drive
Baidu Netdisk
Save Base R Cheat Sheet for Vectors, Indexing and Data Frames to this cloud drive
Base R cheat sheet study guide
Follow the path from object types to indexing, functions, data frames and plots, validating normal, empty and missing-value cases before combining steps.
Before you start
- Prepare a PDF reader and a runnable R environment.
- Create a small vector or data frame with normal values, missing values and named columns.
- Record R version, package versions, input encoding and expected output.
Quick start
- 01
Review objects and vectors
Compare vectors, lists, matrices, data frames and factors by type, length, names, dimensions and missing values.
- 02
Practice indexing
Use position, name and logical conditions, checking row and column selection, empty results and NA behavior.
- 03
Encapsulate repeated work
Turn repeated steps into functions with explicit arguments, defaults and return objects instead of hidden global state.
- 04
Produce a reproducible plot
Create one basic plot and record preprocessing, axes, labels, seed, input path and output settings.
Usage tips
- Use small assertions for vector recycling, factor conversion and NA-sensitive steps.
- Distinguish Base R syntax from extension packages and their namespaces.
- Fix path, encoding, versions and random seed before sharing an analysis script.
Troubleshooting and uninstall
Why is a filtered result empty or the row count unexpected?
Check condition length, NA values, encoding and logical operators, then print intermediate type, length and summary.
Why does another computer produce a different result?
Compare R and package versions, locale, random seed, input path and file encoding before comparing the code.
Frequently asked questions
Which Base R topics are covered?
The sheet covers objects, vectors, indexing, functions, data frames, missing values and basic plotting.
Does it include an R installation package?
No. It is a syntax and operation reference, so examples require a separately prepared R environment.
What should a beginner learn first?
Start with object types and vectors, then indexing, data frames, functions and missing-value handling before plotting.
How can a script remain reproducible?
Record input, encoding, R and package versions, random seed, paths and output settings, then rerun from a clean session.