ST 308 Quiz 1 | Questions and Answers What is the purpose of the R console? The console is where... a.) code is submitted to be evaluated b.) you can locate plots that have been created c.) you easily write code to save for later use d.) the help file associated with an R function appears What is...
What is the purpose of the R console? The console is where...
a.) code is submitted to be evaluated
b.) you can locate plots that have been created
c.) you easily write code to save for later use
d.) the help file associated with an R function appears
What is the syntax used to store the output of some code in an R object? (Just write the
symbol(s) needed and nothing else.)
<- or =
Suppose you ran the code below:
my_sum <- sum(c(1:10))
my_sum
True of False: Each time you submit my_sum in the console, R has to execute the sum
function.
False
What functions help us to understand an R object we may be working with?
str
plot
class
summary
typeof
Note: We are about to jump into R and write some code! We talk about 'comments'
there. A comment in a programming language is text that will be ignored when sent to
the console (allowing you to write notes to yourself).
In R, the # sign starts a comment.
#Here I'll find the mean mean(iris$Sepal.Length)
If these two lines are submitted to the console, the first is ignored!
Just pick True for the answer to this question.
True
, 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
Character
TRUE or FALSE: Each time you type final_answer into the console, R has to execute
the log and exp functions.
False
What is the name of the R function we discussed that will compactly display the internal
structure of an R object?
Simply give the name of the function as your answer (case sensitive). For instance, if
the answer is the 'hist' function, simply answer:
hist
Str
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)?
a. the cars object was loaded in from an external file
b. R doesn't know how to print every type of object
c. R is determining how to use print() based on the type of object used as the input
d. R is running into an error
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.
Select one:
True
False
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Jumuja. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $15.99. You're not tied to anything after your purchase.