# Vamos a Crear Notebook con R
install.packages('dplyr')
Installing package into ‘/work/.R/library’
(as ‘lib’ is unspecified)
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
starwars %>%
filter(species == "Droid")
starwars %>%
select(name, ends_with("color"))
starwars %>%
group_by(species) %>%
summarise(
n = n(),
mass = mean(mass, na.rm = TRUE)
) %>%
filter(
n > 1,
mass > 50
)
install.packages('ggplot2')
Installing package into ‘/work/.R/library’
(as ‘lib’ is unspecified)
library(ggplot2)
diamonds %>%
filter(depth > 60) %>%
group_by(cut) %>%
summarize(mean_price = mean(price)) %>%
ggplot(aes(x = cut, y = mean_price)) +
geom_bar(stat = "identity")