rbind Data Frames by Column Index in R (Example) | Ignore Variable Names | setNames & names Function

preview_player
Показать описание
R code of this video:

x2 = letters[1:5])

y2 = letters[5:1])

data_all <- rbind(data1, data2) # rbind returns error message

data_all <- rbind(data1, # Rename columns & rbind
setNames(data2, names(data1)))

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Very nice demo. How about doing this is in dplyr? I tried bind_rows(df_1, df_2) and go the correct number of rows. However, it generated four columns and filled in missing values with NAs. I suspect there is a way to merge these into two columns...

haraldurkarlsson
join shbcf.ru