Geschrieben von Student*innen, die bestanden haben Sofort verfügbar nach Zahlung Online lesen oder als PDF Falsches Dokument? Kostenlos tauschen 4,6 TrustPilot
logo-home
Notizen

DSCI Tutorial 1 - Intro_solution (2022)

Bewertung
-
Verkauft
-
seiten
12
Hochgeladen auf
11-04-2022
geschrieben in
2021/2022

dsci 100 tutorial 1 - intro_solution

Hochschule
Kurs

Inhaltsvorschau

Tutorial 1: Introduction to Data Science
Lecture and Tutorial Learning Goals:
After completing this week's lecture and tutorial work, you will be able to:

use a Jupyter notebook to execute provided R code
edit code and markdown cells in a Jupyter notebook
create new code and markdown cells in a Jupyter notebook
load the tidyverse library into R
create new variables and objects in R using the assignment symbol
use the help and documentation tools in R
match the names of the following functions from the tidyverse library to their documentation descriptions:
read_csv
select
mutate
filter
ggplot
aes

Any place you see ... , you must fill in the function, variable, or data to complete the code. Replace fail() with your completed code and run the
cell!

Reminder: All autograded questions (i.e., questions with tests) are worth 1 point and all hidden test and manually graded questions are worth 3 points.


In [ ]:

### Run this cell before continuing.
library(repr)
options(repr.matrix.max.rows = 6)
source("tests.R")
source("cleanup.R")


Revision Question Match the following definitions with the corresponding functions used in R:
{points: 1}

Definitions

A. Reads the most common types of flat file data, comma separated values.

B. Keeps only the variables you mention.

C. Keeps only rows with entries satisfying some logical condition that you specify.

D. Adds a new variable to a data frame as a function of the old columns.

E. Declares the input data frame for a graphic and specifies the set of plot aesthetics intended to be common throughout all subsequent layers unless
specifically overridden.

Functions

1. ggplot
2. select
3. filter
4. read_csv
5. mutate

For each definition, assign the integer corresponding to the correct function to the letter object associated with the defintion. For example:

B <- 1


Assign your answers to the objects A , B , C , D , and E . Your answers should each be a single integer.

, In [ ]:

# Replace the fail() with your answer.

### BEGIN SOLUTION
E <- 1
B <- 2
A <- 4
D <- 5
C <- 3
### END SOLUTION

In [ ]:

test_revision()



1. Vickers and Vertosick Exercise
We hope you haven't forgotten about them just yet! As you might recall from lecture, Vickers and Vertosick were the researchers that wanted to study
different factors affecting race performance of recreational runners. They assembled a data set that includes the age, sex, and Body Mass Index (BMI) of
runners, comparing it with their timed performance (how long it took them to complete either 5 or 10 km runs).

We will be continuing our analysis of their data to practice what you learnt during the previous lecture. The goal for today, however, is to produce a plot of
BMI against the time (in minutes) it took for participants under the age of 35 to run 5 kilometres. To do this, we will need to complete the following steps:

1. use filter to extract the rows where age is less than 35
2. use select to extract the bmi and km5_time_seconds columns
3. use mutate to convert 5 km race time from seconds ( km5_time_seconds ) to minutes
4. use ggplot to create our plot of BMI (x-axis) and race time in minutes (y-axis)

Tips for success: Try going through all of the steps on your own, but don't forget to discuss with others (classmates, TAs, or an instructor) if you get
stuck. If something is wrong and you can't spot the issue, be sure to read the error message carefully. Since there are a lot of steps involved in working
with data and modifying it, feel free to look back at worksheet_01 (https://github.com/UBC-DSCI/dsci-
100/blob/master/materials/worksheet_01/worksheet_01.ipynb) for assistance.


Question 1.1 Multiple Choice
{points: 1}

After reading the text above (and remembering that filter lets us choose rows that have values at, above, or below a threshold), what column do you
think we will be using for our threshold when we filter?

A. age

B. km5_time_seconds

C. bmi

D. sex

Assign your answer to an object called answer1.1 . Make sure to write the uppercase letter for the answer you have chosen and surround the letter with
quotes.


In [ ]:

# Make sure the correct answer is an uppercase letter.
# Surround your answer with quotation marks.
# Replace the fail() with your answer.

### BEGIN SOLUTION
answer1.1 <- "A"
### END SOLUTION


In [ ]:

test_1.1()


Question 1.2 True or False
{points: 1}

We will be selecting the columns age and km5_time_seconds to plot. True or false?

Assign your answer (of either "true" or "false" ) to an object called answer1.2 . Make sure to write in all lower-case and surround your answer
with quotes.

Schule, Studium & Fach

Hochschule
Studium
Kurs

Dokument Information

Hochgeladen auf
11. april 2022
Anzahl der Seiten
12
geschrieben in
2021/2022
Typ
Notizen
Professor(en)
Jack davis
Enthält
Alle klassen

Themen

7,13 €
Vollständigen Zugriff auf das Dokument erhalten:

Falsches Dokument? Kostenlos tauschen Innerhalb von 14 Tagen nach dem Kauf und vor dem Herunterladen kannst du ein anderes Dokument wählen. Du kannst den Betrag einfach neu ausgeben.
Geschrieben von Student*innen, die bestanden haben
Sofort verfügbar nach Zahlung
Online lesen oder als PDF

Lerne den Verkäufer kennen

Seller avatar
Bewertungen des Ansehens basieren auf der Anzahl der Dokumente, die ein Verkäufer gegen eine Gebühr verkauft hat, und den Bewertungen, die er für diese Dokumente erhalten hat. Es gibt drei Stufen: Bronze, Silber und Gold. Je besser das Ansehen eines Verkäufers ist, desto mehr kannst du dich auf die Qualität der Arbeiten verlassen.
travissmith1 UBC
Folgen Sie müssen sich einloggen, um Studenten oder Kursen zu folgen.
Verkauft
97
Mitglied seit
4 Jahren
Anzahl der Follower
61
Dokumente
36
Zuletzt verkauft
5 Jahren vor

3,6

16 rezensionen

5
6
4
6
3
0
2
0
1
4

Kürzlich von dir angesehen.

Warum sich Studierende für Stuvia entscheiden

on Mitstudent*innen erstellt, durch Bewertungen verifiziert

Geschrieben von Student*innen, die bestanden haben und bewertet von anderen, die diese Studiendokumente verwendet haben.

Nicht zufrieden? Wähle ein anderes Dokument

Kein Problem! Du kannst direkt ein anderes Dokument wählen, das besser zu dem passt, was du suchst.

Bezahle wie du möchtest, fange sofort an zu lernen

Kein Abonnement, keine Verpflichtungen. Bezahle wie gewohnt per Kreditkarte oder Sofort und lade dein PDF-Dokument sofort herunter.

Student with book image

“Gekauft, heruntergeladen und bestanden. So einfach kann es sein.”

Alisha Student

Häufig gestellte Fragen