How to combine unequal data frames and replace missing data with zero in the R programming language. More details: https://statisticsglobe.com/merge-une...
R code of this video:
data1 <- data.frame(id = 1:5, # Create first data frame
x1 = 5:9,
x2 = 5:1)
data2 <- data.frame(id = 3:7, # Create second data frame
y1 = 20:24,
y2 = 10:14)
data_all <- merge(data1, data2, # Merge data
by = "id",
all = TRUE)
data_all[is.na(data_all)] <- 0 # Replace NA with 0
Follow me on Social Media:
Twitter: / joachimschork
Facebook: / statisticsglobecom
Reddit: / joachimschork
Pinterest: https://www.pinterest.de/JoachimSchork
Nesta página do site você pode assistir ao vídeo on-line How to Merge Two Unequal Data Frames & Replace NA with 0 in R (Example) | merge & is.na Functions duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Statistics Globe 16 Novembro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 4,118 vezes e gostou 52 espectadores. Boa visualização!