Environment

The Environment tab is your window into what R is holding in memory. Instead of typing ls() or str() in the console every time you want to check on a variable, you can just switch to Environment and see everything at a glance: names, types, sizes, and even short previews of what each variable contains.

Your variables, at a glance

Once you start creating variables in the Console or Editor, they show up here automatically. The list refreshes in real time, so you will see new variables appear right after you create them.

Each variable row shows you four things: the name you assigned it, the class (like data.frame or numeric), the memory size it occupies, and a short preview of the first few values. That preview alone can save you a lot of typing. You can quickly confirm that x really does contain what you think it does without printing it.

How variables are organized

Your variables are automatically sorted into groups based on their R type. This makes it easy to find what you are looking for, especially when your environment starts getting crowded:

  • Data Frames: includes data.frame, tibble, and data.table objects
  • Matrices: matrix and array types
  • Lists: nested list structures
  • Functions: any custom functions you have defined
  • Values: everything else: vectors, scalars, strings, logicals, and so on

If you have added any variables to your watch list (more on that below), they appear at the very top in their own “Watched” section, regardless of type.

Inspecting a variable in detail

Tap any variable to open a detail sheet with much richer information than the list preview. What you see depends on the type:

For data frames, you get a list of all columns with their types and sample values, plus a text preview of the first 10 rows. There is also an “Open in Data Frame Viewer” button that gives you a full scrollable table view, handy for exploring larger datasets.

For vectors and scalars, you see the full value (with up to 15 digits of precision for numbers), or a summary and the first 20 elements for longer vectors.

For lists, you see the structure from str() along with the name, type, and preview of each element.

For functions, you see the function signature (arguments) and the body of the function.

Every detail view also includes a “Copy as R Code” section that gives you the dput() output, essentially the R code you would need to recreate that variable from scratch. This is useful for sharing data with someone or saving a snapshot.

Left: Variable detail sheet showing columns, preview, and copy-as-code options. Right: Data Frame Viewer with a full scrollable table of rows and columns.

Quick actions with long press

You do not always need the full detail sheet. Long-press (or right-click on iPad) on any variable to get a context menu of quick actions:

  • Summary: runs summary() and shows the result in a popup
  • Structure: runs str() so you can see the internal structure
  • Head: shows head() output (the first few rows or elements)
  • Print: runs print() for the full output
  • Plot: generates a quick plot of the variable (the plot appears in the Plots tab)

These quick actions save you from switching to the Console just to run a one-off inspection command.

Watching variables

If there are certain variables you want to keep an eye on, maybe a running total or a data frame you are building up incrementally, you can add them to your watch list. Watched variables are always pinned to the top of the Environment list so you can find them instantly.

To watch a variable, swipe right on it and tap Watch. You will see a small star badge appear next to the name. To stop watching, swipe right again and tap Unwatch, or use the long-press menu.

You can clear the entire watch list at once from the menu (the ... button in the toolbar).

Searching and filtering

When your environment gets large (and it will, once you start experimenting), use the search bar to filter variables by name. Just start typing, and the list narrows down to matching variables. This is much faster than scrolling through dozens of entries.

Deleting variables

To remove a variable from the R environment, swipe left on it and tap Delete. This runs rm() behind the scenes, so the variable is gone from memory immediately.

If you want to start fresh, tap the menu button (...) and choose Clear Environment. This removes everything from .GlobalEnv, including all your variables, data frames, and functions. You will get a confirmation prompt first, since this cannot be undone.

The Packages tab

The Environment screen also has a second tab, Packages, accessible via the segmented control at the top. This shows your installed R packages and lets you load, unload, or remove them. For the full story on package management, see the Packages guide.

Pull down on the variable list to manually refresh if you ever think the display is out of sync. You can also tap Refresh from the menu.