I have 2 lists, one with Gender c('m', 'f', 'f', 'm', 'f')
, the other with names c('Peter', 'Peter', 'Anna', 'Anna', 'Peter')
.
I want to join
/ merge
the two columns to a data frame, where the sex-values are suitable to the names (Peter with m, Anna with f).
How to I do this in R?
Thanks for helping guys!
Suppose you have the following two lists:
One option would be to use
unlist
and combine them into adata.frame
: