DATOS.MOTOS= read.table("DATOS MOTOS.csv", header= TRUE, sep = ";", encoding = "latin1",
                        stringsAsFactors =  TRUE)

summary(DATOS.MOTOS)
##                            NOMBRE     PRECIO.VENTA         AÑO      
##  Bajaj Pulsar 150             : 41   Min.   :  5000   Min.   :1988  
##  Royal Enfield Classic 350    : 27   1st Qu.: 28000   1st Qu.:2011  
##  Honda Activa [2000-2015]     : 23   Median : 45000   Median :2015  
##  Honda CB Hornet 160R         : 22   Mean   : 59638   Mean   :2014  
##  Bajaj Pulsar 180             : 20   3rd Qu.: 70000   3rd Qu.:2017  
##  Royal Enfield Thunderbird 350: 19   Max.   :760000   Max.   :2020  
##  (Other)                      :909                                  
##     TIPO.VENDEDOR        DUEÑO      km.RECORRIDO     EXPO.PRECIO     
##  Dealer    :   6   1st owner:924   Min.   :   350   Min.   :      0  
##  Individual:1055   2nd owner:123   1st Qu.: 13500   1st Qu.:  54760  
##                    3rd owner: 11   Median : 25000   Median :  72303  
##                    4th owner:  3   Mean   : 34360   Mean   :  87262  
##                                    3rd Qu.: 43000   3rd Qu.:  87000  
##                                    Max.   :880000   Max.   :1278000  
##                                                     NA's   :430      
##         PORCENT   
##             :430  
##  0,497344182:  6  
##  0          :  5  
##  0,74594393 :  5  
##  0,833333333:  5  
##  0,30965025 :  4  
##  (Other)    :606
DATOS.MOTOS= read.table("DATOS MOTOS.csv", header= TRUE,
                        sep = ";", encoding = "latin1",
                        stringsAsFactors =  TRUE)
var(DATOS.MOTOS$PRECIO.VENTA)
## [1] 3170173295
var(DATOS.MOTOS$EXPO.PRECIO)
## [1] NA
## DIGRAMA DE BARRAS PARA PROPIETARIOS ACTUALES DE LA MOTO
barplot(table(DATOS.MOTOS$DUEÑO) , col = c("skyblue","blue", "darkblue", "cadetblue"),
        main = "propietarios actualues de las motos",
        xlab = "propietarios",
        ylab = "frecuencia")

library(ggplot2)

library(ggplot2)

##HISTOGRAMAS VARIABLES CUANTITATIVAS
ggplot(DATOS.MOTOS, aes(y = PRECIO.VENTA))+
  geom_boxplot()+
  scale_fill_brewer(palette="pinks")
## Warning: Unknown palette: "pinks"

ggplot(DATOS.MOTOS, aes(x = km.RECORRIDO))+
  geom_histogram(fill="red")
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.

ggplot(DATOS.MOTOS, aes(x = PRECIO.VENTA))+
  geom_histogram(fill="orange")
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.

ggplot(DATOS.MOTOS, aes(x = EXPO.PRECIO))+
  geom_histogram(fill="yellow")
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
## Warning: Removed 430 rows containing non-finite outside the scale range
## (`stat_bin()`).

## Diagrama de dispercion entre costo de venta y costo de exposicion
ggplot(DATOS.MOTOS, aes(x = PRECIO.VENTA, y = EXPO.PRECIO)) +
  geom_point(color = "red", size = 3, alpha = 0.7) +
  geom_smooth(method = "lm", se = FALSE, color = "blue") +  # Línea de tendencia
  labs(title = "Diagrama de Dispersión Costo de venta y de exposición",
       x = "Costo de venta",
       y = "Costo de exposición") +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 430 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 430 rows containing missing values or values outside the scale range
## (`geom_point()`).

  ## Diagrama de barras de tipo de vendedor
ggplot(DATOS.MOTOS, aes(x = TIPO.VENDEDOR))+
  geom_bar(fill = "darkgreen")

    ##
ggplot(DATOS.MOTOS, aes(x = AÑO, y = PRECIO.VENTA)) +
  geom_point(alpha = 0.6) +
  geom_smooth(method = "lm", color = "red") +
  labs(title = "Relación Precio vs Año de Fabricación",
       x = "Año", y = "Precio de Venta")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(DATOS.MOTOS, aes(x = km.RECORRIDO, y = PRECIO.VENTA)) +
  geom_point(alpha = 0.5) +
  geom_smooth(method = "loess", color = "red") +
  labs(title = "Relación Precio vs Kilómetros Recorridos")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(DATOS.MOTOS, aes(x = AÑO, y = km.RECORRIDO)) +
  geom_point(alpha = 0.5) +
  geom_smooth(method = "loess", color = "GREEN") +
  labs(title = "Relación Precio vs Kilómetros Recorridos")
## `geom_smooth()` using formula = 'y ~ x'

cor(DATOS.MOTOS$km.RECORRIDO, DATOS.MOTOS$AÑO)
## [1] -0.2886754
## la relacion es negativa y baja


cor(DATOS.MOTOS$PRECIO.VENTA, DATOS.MOTOS$EXPO.PRECIO)
## [1] NA
cor(DATOS.MOTOS$PRECIO.VENTA, DATOS.MOTOS$km.RECORRIDO)
## [1] -0.2129367
##r = cor(DATOS.MOTOS[,2:3,6:7])
##corrplot(r, method="number")

Conclusiones `

Problemas con los datos

Propietarios de motos

Distribución de precios de venta

Kilómetros recorridos

Relación entre precio de venta y precio de exposición

Tipo de vendedor

Relación entre año de fabricación y precio de venta

Relación entre kilómetros recorridos y precio de venta

Relación entre año y kilómetros recorridos