0
I have two dataframes and would like to transform the data of the two columns of the 2nd df into rows to be added in sequence of the data of the 1st df. To illustrate create the two df and the final result.
df1 = data.frame(c("MG","SP","RJ","ES","PA"),c("PA","ES","MG","SP","RJ"))
colnames(df1) = c("Nome", "Estado")
df2 = data.frame(c("PA","ES","MG","SP","RJ"),c("MG","SP","RJ","ES","PA"))
colnames(df2) = c("Estado", "Nome")
The result would turn df into 10 notes with 2 columns:
df3 = data.frame(c("MG","SP","RJ","ES","PA","PA","ES","MG","SP","RJ"),c("PA","ES","MG","SP","RJ","MG","SP","RJ","ES","PA"))
colnames(df3) = c("Nome", "Estado")
rbind.data.frame(df1, df2)
?– neves