https://bit.ly/3LWSBQK
Importing libraries:
filter()
: it filters the observations (rows) by satisfying a criterionmutate()
: creates a new variable (column) based on existing variables.select()
: selects variables (columns)
group_by()
: groups observations according to the categories of a variable.drop_na()
: gets rid of NA values in the entire dataset or in certain variables.summarise()
: reduces multiple values to a single value based on an operation (e.g. mean()
)A common set of operation are written as:
What are the max and min body sizes for Adelie and Gentoo penguins?
ggplot2
Importing libraries:
ggplot(
data = penguins,
aes(
x = flipper_length_mm,
y = bill_length_mm
)
) +
geom_point(
aes(
color = species,
shape = species
),
size = 3,
alpha = 0.8
) +
scale_color_manual(values = c("darkorange", "purple", "cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for Adelie, Chinstrap and Gentoo Penguins at Palmer Station LTER",
x = "Flipper length (mm)",
y = "Bill length (mm)",
color = "Penguin species",
shape = "Penguin species"
) +
theme(
legend.position = c(0.85, 0.15),
plot.title.position = "plot",
plot.caption = element_text(hjust = 0, face = "italic"),
plot.caption.position = "plot"
)
ggplot(data = penguins,
aes(
x = flipper_length_mm,
y = bill_length_mm
)
) +
geom_point(
aes(
color = species,
shape = species
)
) +
scale_color_manual(
values = c(
"darkorange",
"purple",
"cyan4"
)
) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for Adelie, Chinstrap and Gentoo Penguins at Palmer Station LTER",
x = "Flipper length (mm)",
y = "Bill length (mm)",
color = "Penguin species",
shape = "Penguin species"
)
BIOL2205 - Inferencia e Informática - Uniandes