getListElement | R Documentation |
a function to take a list and get a particular part out of each element in the list
getListElement(listolists, whichone = 1)
listolists |
a list |
whichone |
which item to get out of each list (can be numeric or name) |
list of all the elements 'whichone' from each list
len <- 100 # number elements in list
lis <- lapply(1:len, function(l) list(x = (-l), y = l^2)) # create list
getListElement(lis, "x")[1] # should be equal to -1
getListElement(lis, 1)[1] # should be equal to -1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.