I am searching a way for obtaining a large table from a table with a list of species.
Here I give you an example:
I have something like this
data.frame(survey_id = c("ID_1", "ID_2", "ID_3", "ID_4", "ID_5"),
list_1 = c("A", "A", "A", "B", "A"),
list_2 = c("B", "D", "E", "E", "F"),
list_3 = c("C", "", "", "F", ""))
and I want to obtain this
data.frame(survey_id = c("ID_1", "ID_2", "ID_3", "ID_4", "ID_5"),
A = c(1,1,1,0,1),
B = c(1,0,0,1,0),
C = c(1,0,0,0,0),
D = c(0,1,0,0,0),
E = c(0,0,1,1,0),
F = c(0,0,0,1,1))
Any suggestion using pivot_wider function?
Thanks for your help.