Review - Cipher

Stat 251

2026-01-29

Topics to Know

Review: General Programming

Know how to:

  • Define a variable
  • Write a function
  • Write an if/else statement
  • load a package or import a library
  • Create a data table structure
  • Get a column, row, or value from a data table
  • Get an item from a list

Vectors in R - Quick info

x <- c(11, 25, 18, 4, 1, 5, 17, 22, 3,  9)

str(x)
 num [1:10] 11 25 18 4 1 5 17 22 3 9
length(x)
[1] 10

Quick-Info: how many values are below 10?

sum(x < 10)
[1] 5
which(x < 10)
[1]  4  5  6  9 10

Vectors in R - Update values

x <- c(11, 25, 18, 4, 1, 5, 17, 22, 3,  9)

str(x)
 num [1:10] 11 25 18 4 1 5 17 22 3 9
length(x)
[1] 10

Update values: replace all values of 3 by a 4:

Homework - Review

  • in Canvas, accept the Github Classroom link to homework #3

  • Clone the repository to your local machine

  • Render the file index.qmd

Homework - Cipher

  • Not all statements that execute are correct (Part 1: fix mistakes)

  • Part 2: write a decoder

  • Part 3: Decode the secret message!

Next Time

  • Continue working on Homework 3