> 1 + 1
[1] 2
> 2 * 2
[1] 4
> 2 ^ 3
[1] 8
RAdelaide 2025
C
/C++
don’t allow for interactive analysisI regularly work with data containing millions of lines
C
)S
(Bell Labs, Chambers 1977)ggplot2
\(\implies\) Create plots using the grammar of graphicsreadr
\(\implies\) Read files into R
Much of today is inspired by a two-day developers workshop I attended with Hadley Wickham. Also gave me an opportunity to have some great conversations with Winston Chang
R
as a standalone tool \(\implies\) open R
NOT RStudio
linux
: R
R
at it’s ugliest (how I learned R)R Console
.Rhistory
in your working directoryR Studio
makes that easy & convenientR
type q()
Save workspace image? [y/n/c]:
n
then hit Enter.RData
in the folder we’ve been working in.RData
\(\implies\) can lead to dodgy analysis
R
and RStudio
are two separate but connected things
R
is like the engine of your carRStudio
is the ‘cabin’ we use to control the engine
R
that improve our ‘journey’R
does all the calculations, manages the data, generates plots
RStudio
helps manage our code, display the plots etc
tidyverse
, bookdown
, reticulate
, roxygen2
etc.RStudio
I use R Projects
to manage each analysis
RAdelaide25
in your home directoryRStudio
RStudio
will always open in a directory somewhereFiles
pane (bottom-right) to see where it’s lookinggetwd()
in the Console pane)R
File
> New File
> R Script
DataImport.R
This is the basic layout we often work with
We’ll come back to the script window in the next section
bash
terminal (or PowerShell for Windows)Like we did earlier, in the R Console type:
> x <- 5
Where have we created the object x
?
x
in our R Environment
Global Environment
git
tab will also appear for those who use git in their projectURL '/help/library/base/html/00Index.html' not found
> ?sqrt
Help
Tab for the sqrt()
function
base
base
is always installed and loaded with R
As a package author, I’m always reading my own help pages. I simply can’t remember everything I’ve written
R
can be hit & miss
> plot(cars)
Help > Cheatsheets > RStudio IDE Cheat Sheet
Page 2 has lots of hints:
Ctrl + 1
places focus on the Script WindowCtrl + 2
places focus on the ConsoleCtrl + 3
places focus on the Help TabR
is the engine, driving everything we do