How can I convert a data.frame
df <- data.frame(id=c(\"af1\", \"af2\"), start=c(100, 115), end=c(114,121))
To a list of lists
If, like me, you are mostly looking to create lists of lists to use in highcharter
, that same package contains the function list_parse()
(or list_parse2()
if you want to remove names). Simply use it like so:
library(highcharter)
df <- data.frame(id=c("af1", "af2"), start=c(100, 115), end=c(114,121))
LoL <- list_parse(df)
After which you can do the indexing you wanted:
> LoL[[1]]$start
[1] 100