I really wasn't sure how to ask this question so I'm sorry if it's not clear.
The thing is, by accident I stumbled upon a solution to one of my problems, that is how to extract all the 1st columns from a list of objects. The solution I found was
lapply(lst, "[", 1, )
and it works perfectly, but I can't seem to figure out what this part means "[", 1,. Can someone please explain it to me or at least give me some literature on it. Tnx
"[" is the function you're applying to all objects in the list (see ?"[" for more about this function). This function extracts parts of an object. 1 is the argument you're passing to the function, so that "[" extracts the first element in each object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With