You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on this code the last few days but I know nothing about RStudio, so I tried looking for information on google and even tried with AI but still the code doesn't run, it keeps bringing all these error messages, please help:
Code:
Cargar las librerías necesarias
library(readxl)
library(moments)
Cargar los datos desde el archivo Excel (.xlsx) usando la ruta proporcionada
Car <- read_excel("Car.xlsx", sheet = "in")
Limpiar los nombres de las columnas (eliminando comillas y espacios adicionales)
colnames(Car) <- gsub('[\",]', '', colnames(Car))
Verificar los nombres de las columnas después de la limpieza
colnames(Car)
Convertir columnas relevantes a numéricas y factores
plot(density(Car$speed1, na.rm = TRUE), main = "Densidad de Speed1", xlab = "Speed1")
Gráfico de barras para la frecuencia de tipos en Type4
barplot(table(Car$type4), main = "Frecuencia de Type4", xlab = "Type4", ylab = "Frecuencia")
Gráficos de densidad para Pollution3 y Pollution5
plot(density(Car$pollution3, na.rm = TRUE), main = "Densidad de Pollution3", xlab = "Pollution3")
plot(density(Car$pollution5, na.rm = TRUE), main = "Densidad de Pollution5", xlab = "Pollution5")
Boxplot para mostrar la dispersión de los datos en Speed1
boxplot(Car$speed1, main = "Dispersión de Speed1", ylab = "Speed1")
Guardar los gráficos en un archivo PDF
pdf("graficas_tarea.pdf")
plot(density(Car$speed1, na.rm = TRUE), main = "Densidad de Speed1", xlab = "Speed1")
barplot(table(Car$type4), main = "Frecuencia de Type4", xlab = "Type4", ylab = "Frecuencia")
plot(density(Car$pollution3, na.rm = TRUE), main = "Densidad de Pollution3", xlab = "Pollution3")
plot(density(Car$pollution5, na.rm = TRUE), main = "Densidad de Pollution5", xlab = "Pollution5")
boxplot(Car$speed1, main = "Dispersión de Speed1", ylab = "Speed1")
dev.off() Car.xlsx
Instructions:
Based on the examples seen in class, answer the following statements. The submission must be made in a Word document that contains the answers to each of the statements and attach a script with the instructions used to reach the solution to the task.
Each exercise presents a problem appropriate to a distribution, for each one you must make a density graph, as well as answer the questions that are asked using the R functions of cumulative distribution, quartile or density.
Groups of 4 people maximum
Don't forget to indicate name
One delivery per group
What is the average speed in the Speed1 Category?
What is the most common type in the Type4 category?
Kurtosis (kurtosi(x)) tells me the degree of skewness of a data set (true or false)
The standard deviation in Pollution type 3 and 5 (pollution3 and pollution5) is?
Determine how dispersed the data is from the mean (Insert name)
The text was updated successfully, but these errors were encountered:
I've been working on this code the last few days but I know nothing about RStudio, so I tried looking for information on google and even tried with AI but still the code doesn't run, it keeps bringing all these error messages, please help:
Code:
Cargar las librerías necesarias
library(readxl)
library(moments)
Cargar los datos desde el archivo Excel (.xlsx) usando la ruta proporcionada
Car <- read_excel("Car.xlsx", sheet = "in")
Limpiar los nombres de las columnas (eliminando comillas y espacios adicionales)
colnames(Car) <- gsub('[\",]', '', colnames(Car))
Verificar los nombres de las columnas después de la limpieza
colnames(Car)
Convertir columnas relevantes a numéricas y factores
Car$speed1 <- as.numeric(Car$speed1)
Car$type4 <- as.factor(Car$type4)
Car$pollution3 <- as.numeric(Car$pollution3)
Car$pollution5 <- as.numeric(Car$pollution5)
Ejercicio 1: Cálculo de la Velocidad Promedio
vel1 <- mean(Car$speed1, na.rm = TRUE)
vel1
cat("La velocidad promedio de speed1 es", vel1, "\n")
Ejercicio 2: Determinación del Tipo más Frecuente en Type4
Mod1 <- names(which.max(table(Car$type4)))
Mod1
cat("El tipo más frecuente en type4 es", Mod1, "\n")
Ejercicio 3: Cálculo de la Curtosis para Speed1
curtosis1 <- kurtosis(Car$speed1, na.rm = TRUE)
curtosis1
cat("La curtosis de speed1 es", curtosis1, "\n")
Ejercicio 4: Cálculo de la Desviación Estándar para Pollution3 y Pollution5
DESV1 <- sd(Car$pollution3, na.rm = TRUE)
DESV2 <- sd(Car$pollution5, na.rm = TRUE)
cat("La desviación estándar de pollution3 es", DESV1, "\n")
cat("La desviación estándar de pollution5 es", DESV2, "\n")
Ejercicio 5: Cálculo de la Varianza para Speed1
varianza1 <- var(Car$speed1, na.rm = TRUE)
varianza1
cat("La varianza de speed1 es", varianza1, "\n")
Gráficos
Gráfico de densidad para Speed1
plot(density(Car$speed1, na.rm = TRUE), main = "Densidad de Speed1", xlab = "Speed1")
Gráfico de barras para la frecuencia de tipos en Type4
barplot(table(Car$type4), main = "Frecuencia de Type4", xlab = "Type4", ylab = "Frecuencia")
Gráficos de densidad para Pollution3 y Pollution5
plot(density(Car$pollution3, na.rm = TRUE), main = "Densidad de Pollution3", xlab = "Pollution3")
plot(density(Car$pollution5, na.rm = TRUE), main = "Densidad de Pollution5", xlab = "Pollution5")
Boxplot para mostrar la dispersión de los datos en Speed1
boxplot(Car$speed1, main = "Dispersión de Speed1", ylab = "Speed1")
Guardar los gráficos en un archivo PDF
pdf("graficas_tarea.pdf")
plot(density(Car$speed1, na.rm = TRUE), main = "Densidad de Speed1", xlab = "Speed1")
barplot(table(Car$type4), main = "Frecuencia de Type4", xlab = "Type4", ylab = "Frecuencia")
plot(density(Car$pollution3, na.rm = TRUE), main = "Densidad de Pollution3", xlab = "Pollution3")
plot(density(Car$pollution5, na.rm = TRUE), main = "Densidad de Pollution5", xlab = "Pollution5")
boxplot(Car$speed1, main = "Dispersión de Speed1", ylab = "Speed1")
dev.off()
Car.xlsx
Instructions:
Based on the examples seen in class, answer the following statements. The submission must be made in a Word document that contains the answers to each of the statements and attach a script with the instructions used to reach the solution to the task.
Each exercise presents a problem appropriate to a distribution, for each one you must make a density graph, as well as answer the questions that are asked using the R functions of cumulative distribution, quartile or density.
Groups of 4 people maximum
Don't forget to indicate name
One delivery per group
The text was updated successfully, but these errors were encountered: