Document Details

UnbiasedAzalea

Uploaded by UnbiasedAzalea

UVic

2025

Tags

R programming RStudio Data Science Programming

Summary

This document introduces the R programming language and RStudio, its integrated development environment. It explains R concepts, key language terms, and common errors, making it useful for beginners. The document might be for a course or self-study.

Full Transcript

2/12/25, 11:54 AM OneNote R & R Studio Wednesday, January 08, 2025 9:32 AM R is a programming language (+environment or app0 RStudio is an IDE (Integrated development environme...

2/12/25, 11:54 AM OneNote R & R Studio Wednesday, January 08, 2025 9:32 AM R is a programming language (+environment or app0 RStudio is an IDE (Integrated development environment) to work with R language + tools to simplify Why use R? Pros Free and open source Very powerful and flexible Worldwide community of R users Cons Learning curve is steep R Concepts: Coding notation: denoting lines of code: >seq(from = 1, to = 10, by = 1) The > is not part of the code, it indicates start of line in console of RStudio- you may see thus format in resources, but its use is not universal. Script annotations Taking notes in your R code script- very valuable habit to develop. Key R language terms Function: commands r to execute, usually contain arguments Arguments: options or details for the function >function() Object: how R stores all data types- you assign data to objects Types of objects: (Atomic) vector- set of homogenous data types ○ Numeric (1,2,3), character ("a", "b", "s"), logical (TRUE, FALSE) Matrix- 2 dimensional array of homogeneous data types ○ Same types as vector Types of objects: Data Frame: Collection of vectors (columns), each can be of different typer of data (I.e. heterogenous data types across vectors) ○ E.x. like excel sheet Can also be loaded onto RStudio as.csv or xlsx file Key language terms: Packages: specialized sets of functions aimed at particular tasks ○ EX: baseR, stat, ggplot2, tidyverse Base packages and extension packages (need to install to library once, and load each new RStudio session) Projects: in RStudio (.Rproj) stores all the "stuff: you do in your RStudio session ○ But jot output og sode- need to save separate Common errors: Coding errors are usally grammatical Functions, argumanets, object smust match letter case No spaces in object names https://uvic-my.sharepoint.com/personal/lucybryden_uvic_ca/_layouts/15/Doc.aspx?sourcedoc={9faa0b91-e898-498c-a6e1-c5e15b84c2ef}&action=edit&wd=target… 1/2 2/12/25, 11:54 AM OneNote https://uvic-my.sharepoint.com/personal/lucybryden_uvic_ca/_layouts/15/Doc.aspx?sourcedoc={9faa0b91-e898-498c-a6e1-c5e15b84c2ef}&action=edit&wd=target… 2/2