R coding

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:35 AM on 4/9/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards

arithmetic symbols

+, -, *, /, ^

2
New cards

pi and e

pi, exp(

3
New cards

scientific notation

e+, e-

4
New cards

variable

v <-

5
New cards

display the value of a variable as an output on the screen

print(

6
New cards

load data from a file

data_frame <- read.csv(file = ‘‘, header = TRUE/FALSE)

7
New cards

see the names of the variables and the first few rows of values

head(data_frame)

8
New cards

set the number of digits that R outputs

options(digits=

9
New cards

calculate the mean and ignore missing values

mean(data_frame, na.rm=TRUE)

10
New cards

calculate the median

median(

11
New cards

calculate the variance

var(

12
New cards

calculate the standard deviation

sd(

13
New cards

calculate the range as a value

diff(range(data_frame, na.rm=TRUE))

14
New cards

calculate the mean of the first 30 individuals

mean(data_frame[1:30])

15
New cards

make a histogram

hist(data_frame, main = “”, xlab = ““)

16
New cards

make a boxplot

boxplot(data_frame, main = ““, ylab = ““)

17
New cards

make two boxplots together

boxplot(data_frame1, data_frame2, main = ‘‘, ylab = ‘‘, names = c(‘‘,’’), at = 1:2)

18
New cards

make a box plot showing categorical variables

boxplot(y ~ x, data = data_frame, main = ””, ylab = ““)

19
New cards

assign a vector to a variable

v←c(

20
New cards

display the index for the first number of a vector

print(vec[1])

21
New cards

generate a vector with integers 1 to 20

vec <-1:20

22
New cards

generate a vector with values 1 to 20 with a step of 0.5

vec <- seq(1, 20, 0.5)

23
New cards

generate a vector with ten zeroes

v <- rep(0,10)

24
New cards

print the vector indices 2 and 5

print(vec[c(2,5)])

25
New cards

print the vector indices 2 to 5

print(vec[2:5])

26
New cards

print all vector indices except 2 to 5

print(vec[-(2:5)])

27
New cards

print a vector from 1 to 20 with only its odd indices

print(vec[seq(1,20,2)])

28
New cards

plot a scatter plot

plot(x-vector, y-vector, main = ““)

29
New cards

plot a function (continuous line)

plot(x-vector, y-vector, main = ‘‘, type = ‘l’, xlab= ‘‘, ylab = ‘‘, xlim = c(x1, x2), ylim = c(y1, y2))

30
New cards

add a line to a plot and make it red

line(x, y, col = “red”)

31
New cards

f(a) is black with circles. f(b) is red and a line. Add a legend to the bottom right

legend(“bottomright”, legend = c(“f(a)”, “f(b)”), col = c(“black“,”red”), pch = c(1, NA), lty = c(0, 1))

32
New cards

plot x² and 5x from x=0 to x=3 on the same graph. make 5x red. Label the x-axis x and the y-axis f(x). Extend the graph limits from 0 to 5 on x and 0 to 5 on y

curve(x², 0, 3, xlab = ”x”, ylab = “f(x)”, xlim = c(0,5), ylim = c(0,5))

curve(5x, 0, 3, add = TRUE, col = ”red”)