I suggest you create a new R Script "Exercises.R" that contains your solutions, so you don't intermix exercises with lecture notes.
Oh_a_new_object <- 10
0h_a_new_object
# Error: <text>:2:2: unexpected symbol
# 1: Oh_a_new_object <- 10
# 2: 0h_a_new_object
# ^
Oh_a_new_object <- 10
Oh_a_new_object # Exchange the number 0 for the letter O #<<
# [1] 10
another_object2
that contains whole numbers from 123 to 131. The name of the function allowing you to do that is: and the assignment operator that creates the object is .(another_object2 <- seq(123, 131))
# [1] 123 124 125 126 127 128 129 130 131
another_object2
's elements is larger than 128 and smaller than 130.another_object2 > 128 & another_object2 < 130
# [1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE
another_object2 <- another_object2 + 2
another_object2 > 128 & another_object2 < 130
# [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE
another_textobject
that contains the sentence: "I am just another sentence."(another_textobject <- "I am just another sentence.")
# [1] "I am just another sentence."
another_textobject
by 3?another_textobject <- another_textobject * 3
# Error in another_textobject * 3: non-numeric argument to binary operator
rep()
function to repeat another_textobject
five times. The argument to which you need to supply the value 5 is called .rep(another_textobject, times = 5)
# [1] "I am just another sentence." "I am just another sentence." "I am just another sentence."
# [4] "I am just another sentence." "I am just another sentence."
rep()
function to repeat another_object2
three times.rep(another_object2, times = 5)
# [1] 125 126 127 128 129 130 131 132 133 125 126 127 128 129 130 131 132 133 125 126 127 128 129 130 131 132 133
# [28] 125 126 127 128 129 130 131 132 133 125 126 127 128 129 130 131 132 133
rep()
function to repeat each element of another_object2
three times. The argument to which you need to supply the value 3 is called .rep(another_object2, each = 3)
# [1] 125 125 125 126 126 126 127 127 127 128 128 128 129 129 129 130 130 130 131 131 131 132 132 132 133 133 133