Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
UBC-DSCI
GitHub Repository: UBC-DSCI/dsci-100-assets
Path: blob/master/2019-fall/slides/01_tutorial_class_activity.ipynb
2051 views
Kernel: R

Class Activity

Week 1

For this activity, we'll be using a dataset called iris which is included in R and is great for extra practice.
Let's use the head() function to take a look at the variables in the dataset.

head(iris)

Note the <dbl> and <fct> below the variable names. What do they mean?

A sepal is the (typically) green part of the flower. It serves as protection for the flower while it is in bud, and often as support for the petals when in bloom. Source: Wikipedia

Use R to create a scatter plot to explore the relationship between Petal.Length and Sepal.Length of only the Virginica Iris species. Put Petal.Length on the Y-axis and Sepal.Length on the x-axis. Give your axis labels human readable names. Post your groups answers on Piazza when you are done.

BONUS: Use the ggtitle() feature of ggplot to add a title to your graph.

library(tidyverse) library(repr) options(repr.plot.width=4.5, repr.plot.height=3.5)
# solution

Using the visualization we made, what can we say about the relationship between these variables?

Post your groups answers on Piazza when you are done.