Workshop 4_Barrera

Workshop 4.

Using two questions from a prior workshop, use Markdown or Quarto to generate an html file and post it on R Pubs


1.2.5

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.2     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.1.0     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(palmerpenguins)

Attaching package: 'palmerpenguins'

The following objects are masked from 'package:datasets':

    penguins, penguins_raw
penguins = penguins 

Question 3

Make a scatterplot of bill_depth_mm vs. bill_length_mm. That is, make a scatterplot with bill_depth_mm on the y-axis and bill_length_mm on the x-axis. Describe the relationship between these two variables.

ggplot(data = penguins, mapping = aes(x = bill_depth_mm,  
                                      y = bill_length_mm)) + geom_point()
Warning: Removed 2 rows containing missing values or values outside the scale range
(`geom_point()`).

Explanation:The relationship between the two variables cannot be determined, as it shows no pattern/trend.

1.4.3.

Question 1

Make a bar plot of species of penguins,where you assign species to the y aesthetic. How is this plot different?

ggplot(penguins, aes(y = species)) +
  geom_bar()  

Explanation:The plot is different because it is shown as a horizontal bar plot rather than vertically, where the species variable is shown on the y-axis instead of the x-axis.