I have a very basic problem.
I have a two data frames.
The first df1
has 3 columns named col1
and col2
The second df2
has the columns named col3
and col4
and col5
I want to create a third data frame with two columns named Attribute and Value in such a way that Attribute is made of the appended value df1$col1
and df2$col3
value is made of the appended values of df1$col2
and df2$col4
Update:
I don't actually the same number of columns for df1
and df2
. Notice that I ignored col5
of df2
( which is irrelevant for my code)
This means that
colnames(df1) <- colnames(df2) <- c("attribute", "value")
rbind.data.frame(df1, df2)
is not working for me.
How can I achieve this result?