Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
OliviaLorente-Casalini authored Jun 26, 2024
1 parent 4e68806 commit 26ff706
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts_texto_nota.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ library(palmerpenguins)
library(tidyverse)


# exportar como csv -------------------------------------------------------
# tidyverse
write_csv(penguins, "penguins1.csv")

# R base
write.csv(penguins, "penguins2.csv")


# readr -------------------------------------------------------------------
# leer archivos
penguins_tb <- read_csv("penguins.csv")
penguins_tb <- read_csv("penguins1.csv")

# R base
penguins_df <- read.csv("penguins.csv")
penguins_df <- read.csv("penguins2.csv")


# tibble ------------------------------------------------------------------
Expand Down Expand Up @@ -133,7 +141,7 @@ lapply(X = levels(penguins_df_mean_long_str_for$species),

# pipe -------------------------------------------------------------------
# grafica de tendencia media anual de masa corporal para cada especie
plot_mass_island <- read_csv("penguins.csv") |>
plot_mass_island <- read_csv("penguins1.csv") |>
group_by(year, species) |>
summarise(body_mass_g = mean(body_mass_g, na.rm = TRUE)) |>
ggplot(aes(x = year, y = body_mass_g, col = species)) +
Expand All @@ -144,7 +152,7 @@ plot_mass_island <- read_csv("penguins.csv") |>
plot_mass_island

# R base
penguins_df <- read.csv("penguins.csv")
penguins_df <- read.csv("penguins2.csv")

aggregated_data <- aggregate(body_mass_g ~ year + species, data = penguins,
FUN = function(x) mean(x, na.rm = TRUE))
Expand Down

0 comments on commit 26ff706

Please sign in to comment.