I have a file ("tmp_list.txt") containing a list of 2D lists of unequal length, like this:
[[1, 2], [3, 4]]
[[3, 4, 5], [4, 5, 6]]
I can't seem to figure out a way to read it into R as a list. This is as far as I got:
x <- scan("tmp_list.txt",what="",sep="\n")
y <- strsplit(x, "[[:space:]]+")
which gives me this:
[[1]]
[1] "[[1," "2]," "[3," "4]]"
[[2]]
[1] "[[3," "4," "5]," "[4," "5," "6]]"
but then I have no idea how to get the actual numeric lists, like [1,2],[3,4] for the first element (it thinks that y[[1]] is a character).
Please help!