Easy problem: palmerpenguins and penguins

Hello world. I just wonder why, I have to install palmerpenguins besides tidyverse because I thought it (palmerpenguins) was inside that whole package (tidyverse) in exercise 6, page 62 from "R FOR DATA SCIENCE" - Hadley Wickham. I had to do this to complete the exercise:

install.packages('tidyverse')
library(tidyverse)
install.packages('palmerpenguins')
library(palmerpenguins)

Second, what is the difference between "palmerpenguins" and "penguins"? In some exercise we use this code:

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

instead of palmerpenguins
Thanks! :smiley:

Hi @Grageas ,

the package palmerpenguins is not part of tidyverse (list of core and additional packages shipped with tidyverse can bee seen here https://tidyverse.tidyverse.org/) so you have to install the additional package to make it work.

palmerpenguins is the name of the package and penguins is the name of the variable inside the package holding the data (in this case a data frame).

1 Like

Okay, thank you. The only thing that doesn't add up to me is, why was it only necessary to put this in the beginning without mentioning the package, just the library? Look:

install.packages("tidyverse")
library(tidyverse)

library(palmerpenguins)
library(ggthemes)

(I'm starting in R :smile: )

It is explained in the introduction section:
https://r4ds.hadley.nz/intro.html#prerequisites

We’ll use many packages from outside the tidyverse in this book. For example, we’ll use the following packages because they provide interesting datasets for us to work with in the process of learning R:

install.packages(
  c("arrow", "babynames", "curl", "duckdb", "gapminder", 
    "ggrepel", "ggridges", "ggthemes", "hexbin", "janitor", "Lahman", 
    "leaflet", "maps", "nycflights13", "openxlsx", "palmerpenguins", 
    "repurrrsive", "tidymodels", "writexl")
  )

So you can see that the palmerpenguins and ggthemes are considered installed as per prerequisites. So it is assumed you did it already - thus there is no need to install them in later chapters :smiley:

True! :sweat_smile: So, does it mean, (since book says) those are always in the IDE of RStudio (at least in my version)? And, if I see the error mentioned, for example:
" #> Error in library(ggrepel) : there is no package called 'ggrepel' " , that is the moment when I have to write

install.packages('ggrepel')

(Maybe because there was a problem and it couldn't install it before)

I guess my version had installed palmerpenguins and then, a few days later it was erased (I don't know how :joy:) Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.