Computer Science > EXAM > ST 308 Quiz 1 | Questions and Answers (All)
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 easi ... ly 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 Suppose you ran the code below: final_answer <- log(2.14.6/1.9) - 2exp(4) final_answer 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 If you want to look at the help documentation for the "hist" function, what code can you submit to the console? Type the entire line of code as your answer. help(hist) What is an (atomic) vector in R? a. One-dimensional object whose elements can be of differing types. b. One-dimensional object whose elements are all the same type. c. Two-dimensional object whose elements are all of the same type. d. Two-dimensional object whose elements can be of differing types. What function can be used to combine elements into a vector? a. combine() b. vec() c. create_vector() d. c() What number is the first element of an atomic vector in R given? (That is, at what index does R start counting?) 1 or one Suppose the following R code is run: vec <- 1:20 What syntax would return the ninth element of vec? vec[9] What is a data frame in R? a. One dimensional object whose elements are all the same type. b. Two-dimensional object whose elements are all of the same type c. Two-dimensional object where the elements can be of any type (no structure required). d. Two-dimensional object where each column is a vector (these vectors can be of differing types). We can use [ ] after a data frame object to subset that data frame. True False What symbol do we often use at the end of a data frame to return a single column (variable)? Just put the actual symbol itself! $ What is list in R? a. One dimensional object whose elements can be of differing types. b. One dimensional object whose elements are all the same type. c. Two-dimensional object whose elements are all of the same type. d. Two-dimensional object whose elements can be of differing types. What function creates a list? Simply put the name of the function or the name of the function followed by (). For example, if the answer were 'hist' you can put hist or hist(). List There is no difference in using [ ] to access list elements versus using [[ ]] to access list elements. True False What is the connection between lists and data frames? a. A list is a data frame, just more general. b. A data frame is a list of equal length vectors. c. A list is a data frame where we flatten the columns to each be a list element. You can use a dollar sign to subset a (named) list, similar to how we subsetted a data frame. True False What is a delimiter in a raw data file? a. The function used to read raw data into R. b. A raw data value. c. A character that separates data values in a raw data file. d. A type of file. The readr package is part of the tidyverse. True False What is meant by the term working directory? a. The method in which the file was created. b. The location of a file on your computer (or a URL). c. The method for accessing the metadata about the file. d. The folder (usually on your computer) where R is looking for files by default. All of the common arguments to read_csv() must be specified by you when you use the function. (Arguments like col_names and na.) [Show More]
Last updated: 1 year ago
Preview 3 out of 9 pages
Loading document previews ...
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Sep 03, 2024
Number of pages
9
Written in
All
This document has been written for:
Uploaded
Sep 03, 2024
Downloads
0
Views
20
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·