I am wondering if there is a built in command in R that would replicate the pd.get_dummies() function in python.
What this does is, for example I have a data set T
Chris Male
Mary Female
Bob Male
John Male
I want it to convert these unique categories (Male and Female) into binary data, such as having it show as
Male Female
Chris 1 0
Mary 0 1
Bob 1 0
John 1 0
Would anyone be able to shine some light on this? I would like to know the function and package that would need to be applied. If there does not exist one, how would you convert it?