From 746a7a574dba790ba7027a15c1c430aa238831fe Mon Sep 17 00:00:00 2001 From: Julen Astigarraga Date: Thu, 30 May 2024 13:55:54 +0200 Subject: [PATCH] elimino comentariosinnecesarios --- scripts_texto_nota.R | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts_texto_nota.R b/scripts_texto_nota.R index 0277d81..30d5293 100644 --- a/scripts_texto_nota.R +++ b/scripts_texto_nota.R @@ -149,17 +149,14 @@ par(mar = c(5, 4, 4, 8), xpd = TRUE) plot(aggregated_data$year, aggregated_data$body_mass_g, type = "n", xlab = "year", ylab = "mean body mass (g)", xaxt = "n") -# Separar los datos por especie species_data_list <- split(aggregated_data, aggregated_data$species) -# Función para dibujar líneas plot_species_line <- function(data, color) { lines(data$year, data$body_mass_g, col = color, type = "o") } species_colors <- c("Adelie" = "red", "Chinstrap" = "green", "Gentoo" = "blue") -# Aplicar la función a cada elemento de la lista utilizando lapply lapply(names(species_data_list), function(species) { plot_species_line(species_data_list[[species]], species_colors[[species]]) }) @@ -169,5 +166,3 @@ axis(1, at = c(2007, 2008, 2009)) legend("topright", inset = c(-0.3, 0.3), legend = names(species_colors), col = species_colors, lty = 1, title = "Species") - -