-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabWeek2.R
More file actions
50 lines (40 loc) · 741 Bytes
/
LabWeek2.R
File metadata and controls
50 lines (40 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Basic syntax
2+2
-3*5
(20-10)/2.5
7^2
abs(-10)
sqrt(81)
log(4)
log(8, base = 2)
round(123.456789, digits = 2)
x <- 7
y <- 4+4
my_name <- "Kelly Ho"
sqrt(x)
(x*y)/2
#Vectors and dataframes
primes <- c(2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
terms <- c("Michaelmas", "Hilary", "Trinity")
one_to_ten <- 1:10
decimals <- seq (0,10, by = 0.1)
rep(terms, times = 10)
length(primes)
sum(primes)
mean(primes)
median(primes)
max(primes)
min(primes)
one_to_ten > 6
students <- c("Kelly", "Eleanor", "Yubo")
grade <- c(100, 20, 20)
pass <- grade >= 50
my_dataframe <- data.frame(students, grade, pass)
View(my_dataframe)
#Loading a dataset
brexit <- read.csv("brexit.csv")
View(brexit)
dim(brexit)
colnames(brexit)
summary(brexit)
head(brexit)