ST308 QUESTIONS & VERIFIED ANSWERS
There is a built-in R object called (note that R is case-sensitive):
letters
What is the class of the letters object?
Simply give the name of the class as your answer (case sensitive, no quotes). For
instance, if the answer is the "plot", simply answer:
plot - Answers - Character
How many rows and columns does the built-in iris dataset have? Hint: Use one of the
functions that help you understand your R objects.
- 1 row, 750 columns.
- 750 rows, 1 column
- 150 rows, 5 columns
- 150 columns, 5 rows - Answers - 150 rows, 5 columns
Why does print(cars) produce a different type of output than print(exp)?
- R is determining how to use print() based on the type of object used as the input
- R is running into an error
- R doesn't know how to print every type of object
- the car object was loaded from an external file - Answers - R is determining how to use
print() based on the type of object used as the input
If you look at the help file for a function and see an argument in the function definition
with an = sign and a value next to it, for example, runif(n, min = 0, max = 1), what does
the value to the right of the equal sign represent?
- The value of the argument any time the function is called.
- If the user doesn't specify a value for that argument, this is the default value to use.
-An example of what you might put in as the input for that argument but the value isn't
actually used. - Answers - If the user doesn't specify a value for that argument, this is
the default value to use.
Suppose you ran the code below:
final_answer <- log(2.1*4.6/1.9) - 2*exp(4)final_answer
TRUE or FALSE: Each time you type final_answer into the console, R has to execute
the log and exp functions. - Answers - False , R stores the output of the computation
What is the syntax used to store the output of some code in an R object? - Answers - <-
There is a built-in R object called (note that R is case-sensitive):
letters
What is the class of the letters object?
Simply give the name of the class as your answer (case sensitive, no quotes). For
instance, if the answer is the "plot", simply answer:
plot - Answers - Character
How many rows and columns does the built-in iris dataset have? Hint: Use one of the
functions that help you understand your R objects.
- 1 row, 750 columns.
- 750 rows, 1 column
- 150 rows, 5 columns
- 150 columns, 5 rows - Answers - 150 rows, 5 columns
Why does print(cars) produce a different type of output than print(exp)?
- R is determining how to use print() based on the type of object used as the input
- R is running into an error
- R doesn't know how to print every type of object
- the car object was loaded from an external file - Answers - R is determining how to use
print() based on the type of object used as the input
If you look at the help file for a function and see an argument in the function definition
with an = sign and a value next to it, for example, runif(n, min = 0, max = 1), what does
the value to the right of the equal sign represent?
- The value of the argument any time the function is called.
- If the user doesn't specify a value for that argument, this is the default value to use.
-An example of what you might put in as the input for that argument but the value isn't
actually used. - Answers - If the user doesn't specify a value for that argument, this is
the default value to use.
Suppose you ran the code below:
final_answer <- log(2.1*4.6/1.9) - 2*exp(4)final_answer
TRUE or FALSE: Each time you type final_answer into the console, R has to execute
the log and exp functions. - Answers - False , R stores the output of the computation
What is the syntax used to store the output of some code in an R object? - Answers - <-