Module 1

Lecture

1A

1B

Lab 1A

Variables

Create 2 numeric variables and assign values for each

x = 10
y = 6

Calculate the sum of them

total = x + y
total
## [1] 16

Calculate the square root of the total

sr = sqrt(total)
sr
## [1] 4

Data Structures

Vector

v <- c(1,2,3,4)
v
## [1] 1 2 3 4

Matrix

m <- matrix(1:6, nrow = 2)
m
##      [,1] [,2] [,3]
## [1,]    1    3    5
## [2,]    2    4    6

Dataframe

df <- data.frame(age=c(25,30), name=c("Mo","Tom"), group=c("A", "B"))
df
##   age name group
## 1  25   Mo     A
## 2  30  Tom     B

List

lst <- list(numbers=v, info=df)
lst
## $numbers
## [1] 1 2 3 4
## 
## $info
##   age name group
## 1  25   Mo     A
## 2  30  Tom     B

Install BioconductoR packages

install.packages("BiocManager")
library(BiocManager)
BiocManager::install("ALL")
library("ALL")
data(ALL)