R Fundamentals

A mini-course on the underlying computational model of the R language. When: July 11, 13, 18, 20 (Tuesdays and Thursdays, 9am-noon) Instructor: Dr. Duncan Temple Lang

Resources & Videos


The aim of this course is to help participants understand the relatively small but fundamental computational model underlying the R language. This will help you reason about code before you write and run it, and to debug it if it doesn't do what you want. A sound understanding of this computational model makes programming in R much easier and more productive. Basically, we want you to understand how the R interpreter works.


This is not an introductory course. Participants are expected to have an elementary understanding and prior experience using R, be comfortable with basic R syntax, and to have it pre-installed and running on their laptops. This course is appropriate for motivated beginners as well as intermediate to advanced users who want a better understanding of base R. It is open to UC Davis faculty, graduate students, postdocs, staff, and undergraduates; DSI affiliates will receive priority registration. Not sure if this course is appropriate for you? Contact us (datascience@ucdavis.edu).


This mini-course is intended as an active engagement and not a passive lecture series. We want you to come to each session with questions about why some things worked and others didn't, and to actively learn. Each session includes hands-on “lab” time for you to bring your own data to work with and ask questions, which will help everyone understand and problem solve. Participants are expected to attend all of the 4 sessions.

Topics (including but not limited to):

__What is a REPL __The Global workspace/environment __Variables and Assignment (=, <- ) __Basic data types – vectors __Hierarchy of data types and implicit coercion __Querying an object: class, typeof, length, dim, names, str __Subsetting rules __Categorical data – factors __Aggregate functions - sum, mean, summary, table, __Vectorized functions __Apply functions __How function calls work __Lists __Data Frames __Subsetting in 2-Dimensions __Scoping Rules __Writing Functions __Debugging

Possible additional topics may include: the R formula; S3 class system; Writing Packages; NAMESPACE files; S4 class system.