What is the best way to transform a list of nested characters to numeric? The goal is to apply this to the column 'Times' to then generate a third column with a result (like a mean statistic). It is important to maintain rows that do not contain data (which are rows 1-9 below).
df <- with(df, tapply(df$X1, df$X2, FUN))
library(tidyverse)
a = map(df, paste0, collapse = " ") %>% bind_rows() %>% gather(Position, Times)
> a
# A tibble: 1,619 x 2
Position Times
<chr> <chr>
1 1 ""
2 2 ""
3 3 ""
4 4 ""
5 5 ""
6 6 ""
7 7 ""
8 8 ""
9 9 ""
10 10 0.823611571913153 0.00954654673930752 0.0388007144639849 0.0171526506226838 0.219~
# ... with 1,609 more rows
The dput(a) for rows 1:10:
structure(list(a.Position = c("1", "2", "3", "4", "5", "6", "7",
"8", "9", "10"), a.Times = c("", "", "", "", "", "", "", "",
"", "0.823611571913153 0.00954654673930752 0.0388007144639849 0.0171526506226838 0.219081251336788 0.2907764363945 0.378645574334759 0.253864150829567 0.235011993879071 0.0573025939576098 0.292383292892179 0.0752965287131889 0.180009058773757 0.587338807217526 0.240031940583238 0.660037942910535 0.234009418566699"
)), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"
))