Having a dataframe like this one:
df1 <- data.frame(id = c("id1","id2","id3", "id3"), status = c("open","close","open/close","close"), stock = c("google", "amazon", "yahoo", "amazon"))
the second dataframe:
df2 <- data.frame(id = c("id1","id2", "id2", "id3"), newspaper = c("times", "newyork", "london", "times"))
and the id column is the same between the two dataframe. How is it possible to create a melt/joined dataframe between all case from all columns id, status, stock and newspaper?
Example of expected output:
id status stock newspaper
id1 open google times
id2 close amazon newyork
id2 close amazon london
id3 open/close yahoo times
id3 close amazon times