ST 308 QUESTIONS & VERIFIED ANSWERS
The console is where? - answers - code is submitted to be evaluated
What is the syntax used to store the output of some code in an r object? - answers - <-
What is the class of the letters object? - answers - character
Mtcars is a built in data set in r. You can obtain the column names of a data frame using
the names() function.
True or false: gear is one of the columns. - answers - true
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? - answers - if the user doesn't specify
a value for that argument, this is the default value to use
What is the purpose of the r console? - answers - code is submitted to be evaluated
In the above console, type print(cars) on one line and print(exp) on another. Submit the
code.
Why does print(cars) produce a different type of output than print(exp)? - answers - r is
determining how to use print() based on the type of object used as the input
What is the name of the r function we discussed that will compactly display the internal
structure of an r object? - answers - str
True or false r and rstudio are the same software. - answers - false
If you want to look at the help documentation for the "hist" function, what code can you
submit to the console? - answers - help(hist)
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. - answers - 150 rows, 5 columns
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
How does r do basic mathematical operations on a vector (or numeric data frame)?
That is, if i have a numeric vector called vec and run the code vec*10, how does r
execute the multiplication? - answers - r applies the operation element-wise
The console is where? - answers - code is submitted to be evaluated
What is the syntax used to store the output of some code in an r object? - answers - <-
What is the class of the letters object? - answers - character
Mtcars is a built in data set in r. You can obtain the column names of a data frame using
the names() function.
True or false: gear is one of the columns. - answers - true
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? - answers - if the user doesn't specify
a value for that argument, this is the default value to use
What is the purpose of the r console? - answers - code is submitted to be evaluated
In the above console, type print(cars) on one line and print(exp) on another. Submit the
code.
Why does print(cars) produce a different type of output than print(exp)? - answers - r is
determining how to use print() based on the type of object used as the input
What is the name of the r function we discussed that will compactly display the internal
structure of an r object? - answers - str
True or false r and rstudio are the same software. - answers - false
If you want to look at the help documentation for the "hist" function, what code can you
submit to the console? - answers - help(hist)
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. - answers - 150 rows, 5 columns
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
How does r do basic mathematical operations on a vector (or numeric data frame)?
That is, if i have a numeric vector called vec and run the code vec*10, how does r
execute the multiplication? - answers - r applies the operation element-wise