I have a string that looks like:So every vector element is further divided by commas. Now I only want to extract elements at a certain place. Let's say all the elements before the first comma or all the elements after the second comma.
This is a self-answered QnA meant to instruct users about the pitfalls and benefits of apply. I have seen many answers posted to questions on Stack Overflow involving the use of apply. I have also seen users commenting under them saying that "apply is slow", and should be avoided".
I am trying to apply a function over consecutive values of two vectors. The problem can be simplified to this: