flowchart TD
CRAN[("CRAN<br/>online package repository")]
LIB["Package library<br/>installed on your computer"]
PKG["Packages<br/>e.g. qmethod, ggplot2"]
R["R<br/>the language & engine<br/>that actually runs code"]
RS["RStudio<br/>IDE: editor · console · plots"]
subgraph PROJ["R Project · .Rproj <br/>(one self-contained folder)"]
direction LR
SCRIPT[".R scripts<br/>the code you write"]
DATA["data"]
OUT["outputs<br/>figures, tables, reports"]
end
CRAN -->|"install.packages()"| LIB
LIB -->|"library() loads them"| PKG
PKG -->|"add functions to"| R
RS -->|"friendly front-end for"| R
SCRIPT -->|"written & edited in"| RS
RS -->|"sends code to be run by"| R
SCRIPT -.->|"call functions from"| PKG
SCRIPT -->|"reads"| DATA
SCRIPT -->|"writes"| OUT
PROJ -->|"opened in RStudio;<br/>sets the working directory"| RS
classDef engine fill:#2f6f5e,stroke:#eef3ec,color:#ffffff;
classDef ide fill:#3a5a8c,stroke:#eef3ec,color:#ffffff;
classDef store fill:#7a6a3f,stroke:#f3efdd,color:#ffffff;
class R engine;
class RS ide;
class CRAN,LIB,PKG store;