100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Introduction to Data Science Data Analysis and Prediction Algorithms with R 1st Edition By Rafael Irizarry (Solution Manual) $15.49   Add to cart

Exam (elaborations)

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

 56 views  1 purchase
  • Course
  • Introduction to Data Science Data Analysis and Pre
  • Institution
  • Introduction To Data Science Data Analysis And Pre

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)

Preview 4 out of 246  pages

  • July 13, 2023
  • 246
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
  • Introduction to Data Science Data Analysis and Pre
  • Introduction to Data Science Data Analysis and Pre
avatar-seller
tutorsection
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:

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

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

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

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 tutorsection. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $15.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

71947 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$15.49  1x  sold
  • (0)
  Add to cart