1.2 Variables

Which of the following is *not* a permitted variable name in R?

some-variable


Create a variable called mynum with the value 200.

mynum = 200


Create a character variable called mychar that contains the words "hello world"

mychar = "hello world"


Add 20 to your "mynum" variable and save it to a new variable, "mynum2"

mynum2 = mynum + 20


Use R to calculate 300 divided by 90 (you do not have to save it to a variable)

300 / 90


Use R to calculate 8 to the power of 4 (you do not have to save it to a variable)

8^4


Use the "log" function to compute the natural logarithm of 15

log(15)


The function "cos" computes the trigonometric cosine of a number. Use this function to compute the cosine of 15.

cos(15)