Basic R for Pharmacy
R for pharmaceutical sciences practicals. Written for learners in plain language, tidyverse style, and with pharmacy examples.
Topics covered
Basics
Getting Started
Set up R and RStudio, and run your very first lines of code.
Setting Up an R Project
Organize your files with a clean folder structure so your work is reproducible.
R Basics
Data types and objects, operators, computation, output, and a typical script workflow.
Error Handling and Debugging
Learn to diagnose common R errors and fix them with a clear step-by-step workflow.
More topics
Data Types and Data Structures
Understand R value types, data structures, and practical extraction with indexing.
Data Handling
Import spreadsheets, tidy messy data, and select the rows and columns you need.
Visualization
Create plots with ggplot2.
Math Operations
Use R's arithmetic operators and math functions for doses, kinetics, sequences, and more.
Pipe Operator (%>%)
Learn how to read and write `%>%` pipelines, from simple chains to multi-step data workflows.
Descriptive Statistics
Summarise your data: means, medians, standard deviations, and more.
Linear Regression
Fit straight-line models with lm(), interpret coefficients, and visualize model fits.
How to read a function page
| Section | What you’ll find |
|---|---|
| Required Library | What library is needed to use the function |
| Syntax | How to use the function |
| Argument Overview | Relevant arguments explained |
| Examples | Examples for how to use the function with different arguments |
Many code blocks on this site are interactive. Click Run Code to execute them right here in your browser — no R or RStudio installation needed.