How do I convert df into df2, where df is given by:
> df
ID VALUES
1 1 a,b,c,d
2 2 a
3 3 c,d,f,g
and df2 should look something like:
> df2
ID a b c d f g
1 1 1 1 1 1 0 0
2 2 1 0 0 0 0 0
3 3 0 0 1 1 1 1
where the values from df have been broken out into separate columns and 1s and 0s reflect whether or not the ID was associated with that value (from df).
Is there a specific function for this? I thought this is what table() did but if that's the case I can't figure it out.