1 + 1
[1] 2
2 * 2
[1] 4
2 ^ 3
[1] 8
RAdelaide 2024
July 9, 2024
http://blackochrelabs.au/RAdelaide24
Stephen (Stevie) Pederson (They/Them)
Rcpp
)Stephen (Stevie) Pederson (They/Them)
ngsReports
, extraChIPs
, motifTestR
, transmogR
strandCheckR
, sSNAPPY
, tadar
Made countless typos, horrible decisions and catastrophic errors
I crash R at least once a week…
RevealJS
link below the TOCgit
Experience is the best teacher \(\implies\) please practice your skills
S
(Chambers 1977)S
(Chambers 1977)R
first appeared in 1993
S
code \(\implies\) open-sourceS
ceased development in early 2000s (Chambers retired in 2005)R
is formally run by a volunteer committee (R Core)
ggplot2
\(\implies\) Generating plotsedgeR
\(\implies\) Differential Gene Expression (DGE) for RNA-SeqR
as a standalone tool \(\implies\) open R
NOT RStudio
linux
: Open a terminal then enter R
We can create objects with names
x
<-
symbol is like an arrow i.e. “put the value 5
into x
”
Console
x
only exists in the R Environment
R Studio
makes that easy & convenientR
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
R Projects
to manage each analysisRAdelaide24
in your home directoryRStudio
RStudio
will always open in a directory somewhereFiles
pane (bottom-right) to see where it’s lookingR
We want RStudio to be looking in our new directory (RAdelaide24
)
\(\implies\)R Projects make this easy
(Not needed for any using the Posit cloud)
File
> New Project
> Existing Directory
RAdelaide24
directory \(\implies\) Create Project
R Project
name is always the directory nameFile
> New File
> R Script
DataImport.R
This is the basic layout we often work with
bash
terminal (or PowerShell for Windows)As well as performing simple calculations:
R
has what we call an Environment
(i.e. a Workspace)Like we did earlier, in the R Console type:
Where have we created the object x
?
x
in our R Environment
Global Environment
R Environment
is like your desktop.RData
objectR
can be set to automatically save your environment on exitgit
tab will also appear for those who use git in their projectHelp
pane for the sqrt()
function
base
base
is always installed and loaded with R
Index
at the bottom for a list of functions in the base
packages
R
can be hit & miss
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 Tab