Dear all,
I'm working with two datasets in Rstudio, one have a Date time format DD/MM/YYYY HH:SS and the other only the Date format DD/MM/YYYY, I need to merge these datasets to create a chart with the date as X axis and one Y axis for one series and the other Y axis to the other series.
Can you let me know how can I do this?
I have create tow different charts:
install.packages(tidyverse)
install.packages(janitor)
install.packages("readxl")
install.packages("rpivotTable")
install.packages("plotly")
# Cargar los paquetes instalados
library(tidyverse)
library(janitor)
library(readxl)
library(rpivotTable)
library(dplyr)
library(plotly)
# Mostrar los archivos en el WD
list.files(path = "V://2022//Defectos//", pattern = ".xlsx$",recursive = TRUE)
# Cargar las bases de datos
Clima <- read_excel("V://2022//Defectos//Clima//Estacion_CDCUAUHTEMOC.xlsx")
glimpse(Clima)
# Graficar la humedad relativa
Grafica_Clima<-qplot(`Fecha Local`, `Humedad relativa (%)`, geom=c("smooth"),data = Clima)
ggplotly(Grafica_Clima)
# Cargar las bases de datos
Rechazos <- read_excel("V://2022//Defectos//Rechazo.xlsx")
glimpse(Rechazos)
# Graficar los defectos
Rechazos_MoldeQuebrado <- Rechazos[Rechazos$Causa == "DIMEN. BRUTO NC. CORAZON QUEBRADO", ]
unique(Rechazos_MoldeQuebrado)
Grafica_rechazos<-ggplot(Rechazos_MoldeQuebrado,aes(x = Fecha, y = Cantidad, )) +
geom_smooth()
ggplotly(Grafica_rechazos)
The information for the dataset named Clima is:
| Fecha Local |
Dirección del Viento (grados) |
Dirección de ráfaga (grados) |
Rapidez de viento (km/h) |
Rapidez de ráfaga (km/h) |
Temperatura del Aire (°C) |
Humedad relativa (%) |
Presión Atmosférica (hpa) |
Precipitación (mm) |
Radiación Solar (W/m²) |
| 13/07/2022 16:10 |
10 |
358 |
12.1 |
28.9 |
23.3 |
61 |
798.2 |
0 |
102 |
| 13/07/2022 16:00 |
42 |
62 |
15.7 |
25.5 |
24.4 |
56 |
798.1 |
0 |
139 |
| 13/07/2022 15:50 |
90 |
118 |
24.5 |
41.1 |
27.5 |
41 |
797.9 |
0 |
202 |
| 13/07/2022 15:40 |
107 |
129 |
24.4 |
38.5 |
28.2 |
38 |
797.9 |
0 |
390 |
The information for the dataset named Rechazos is:
| Fecha |
Código |
Artículo |
Causa |
Cantidad |
Peso (kg) |
| miércoles, febrero 28, 2018 |
002784BR00 |
XD 351-H |
COL SHOT. METAL PROJ |
1 |
0.089 |
| martes, mayo 29, 2018 |
002784BR00 |
XD 351-H |
COL SHOT. METAL PROJ |
1 |
0.089 |
I hope you can work with these images, I couldn't upload the files.
Thank you very much.