100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Introduction to Data Science Data Analysis and Prediction Algorithms with R 1st Edition By Rafael Irizarry (Solution Manual)

Rating
-
Sold
1
Pages
246
Grade
A+
Uploaded on
13-07-2023
Written in
2022/2023

Introduction to Data Science Data Analysis and Prediction Algorithms with R, 1e Rafael Irizarry (Solution Manual) Introduction to Data Science Data Analysis and Prediction Algorithms with R, 1e Rafael Irizarry (Solution Manual)

Institution
Introduction To Data Science Data Analysis And Pre
Course
Introduction to Data Science Data Analysis and Pre











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Introduction to Data Science Data Analysis and Pre
Course
Introduction to Data Science Data Analysis and Pre

Document information

Uploaded on
July 13, 2023
Number of pages
246
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Amy L. Gil l and Rafael A. Irizarry
Solution Manual for
Introduction to Data Science Part I
R 1
Chapter 2: R basics
1.1 Section 2.3 Exercises
1. What is the sum of the first 100 positive integers? The formula for the sum of integers 1
through nisn(n+ 1)/2. Define n= 100 and then use R to compute the sum of 1through
100 using the formula. What is the sum?
Answer:
n <-100 # define n
n*(n+1)/2 # note use of multiplication symbol and parentheses
#> [1] 5050
2. Now use the same formula to compute the sum of the integers from 1 through 1,000.
Answer:
n <-1000 # change definition of n
n*(n+1)/2 # same formula as Q1
#> [1] 5e+05
3. Look at the result of typing the following code into R:
n <-1000
x <-seq(1, n)
sum(x)
Based on the result, what do you think the functions seq andsum do? Y ou can use help .
A.sum creates a list of numbers and seq adds them up.
B.seq creates a list of numbers and sum adds them up.
C.seq creates a random list and sum computes the sum of 1 through 1,000.
D.sum always returns the same number.
Answer:
B. Y ou can check the documentation using ?seq and?sum .
4. In math and programming, we say that we evaluate a function when we replace the
argument with a given number. So if we type sqrt(4) , we evaluate the sqrt function. In
R, you can evaluate a function inside another function. The evaluations happen from the
inside out. Use one line of code to compute the log, in base 10, of the square root of 100.
13 14 1 Chapter 2: R basics
Answer:
log10(sqrt(100) ) ##equivalent to: log(sqrt(100), base = 10)
#> [1] 1
5. Which of the following will always return the numeric value stored in x? Y ou can try out
examples and use the help system if you want.
A.log(10^x)
B.log10(x^10)
C.log(exp(x))
D.exp(log(x, base = 2))
Answer:
C. In R,log has a default base of e. Therefore, log andexp are inverse functions.
1.2 Section 2.5 Exercises
1. Load the US murders dataset.
library(dslabs)
data("murders" )
Use the function str to examine the structure of the murders object. W e can see that this
object is a data frame with 51 rows and five columns. Which of the following best describes
the variables represented in this data frame:
A. The 51 states
B. The murder rates for all 50 states and DC
C. The state name, the abbreviation of the state name, the state’s region, and the state’s
population and total number of murders for 2010
D.str shows no relevant information
Answer:
C. Check the output of the code str(murders) .
2. What are the column names used by the data frame for these five variables?
Answer:
names(murders) # find column names
#> [1] "state" "abb" "region" "population" "total"
3. Use the accessor $to extract the state abbreviations and assign them to the object a.
What is the class of this object?
Answer:

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
tutorsection Teachme2-tutor
View profile
Follow You need to be logged in order to follow users or courses
Sold
7427
Member since
2 year
Number of followers
3245
Documents
5817
Last sold
10 hours ago
TutorSection

Best Educational Resources for Student. We are The Only Original and Complete Study Resources Provider in the Market. Majority of the Competitors in the Market are Selling Fake/Old/Wrong Edition files with cheap price attraction for customers.

4.1

1111 reviews

5
651
4
197
3
100
2
55
1
108

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions