Using Reddit API in R
Here are my main recommendations:


use recursion
use names instead of list indices, for example node$data$reply$data$children reads much better than node[[2]][[5]][[2]][[2]] and it is also more robust to data changes.
use well-named variables so you code reads easily




Now for the code:

url       &lt;- "http://www.reddit.com/r/funny/comments/2eerfs/fifa_glitch_cosplay/.json"
rawdat    &lt;- fromJSON(readLines(url, warn = FALSE))
main.node &lt;- rawdat[[2]]$data$children

get.comments &lt;- function(node) {
   comment     &lt;- node$data$body
   replies     &lt;- node$data$replies
   reply.nodes &lt;- if (is.list(replies)) replies$data$children else NULL
   return(list(comment, lapply(reply.nodes, get.comments)))
}

txt &lt;- unlist(lapply(main.node, get.comments))
length(txt)
# [1] 199