I have a table that looks like this:
id pop fre
A:1 sh 0.6
A:1 mi 0.2
A:2 sh 0.9
A:3 mi 0.5
What I want is creating a new table with the second column (pop) as a column names and values of (id) column without repetition. The corresponding values of (fre) column is to be used for filling the table. As an example the above table might looks like this:
id sh mi
A:1 0.6 0.2
A:2 0.9 NA
A:3 NA 0.5
I tried to use reshape function in R, however I keep getting an error about data-frame columns. I appreciate any ideas that might help.