I've this situation:
foo <- data.frame("vars" = c("animal: mouse | wks: 12 | site: cage | PI: 78",
"animal: dog | wks: 32 | GI: 0.2",
"animal: cat | wks: 8 | site: wild | PI: 13"))
where variable names and relative data were stored in character strings like the above example. In particular, each variable_name/its_data unit were delimited by a |
. After the :
there is the relative data.
I would like to have a final dataframe like this:
animal wks site PI GI
mouse 12 cage 78 NA
dog 32 <NA> NA 0.2
cat 8 wild 13 NA