“[“ is actually a function in R. When using FUN=”[“, the first argument to “[“ is the current element of the list (being iterated over), ie, the object being subsetted. While the subsequent arguments are the indexes to “[“
Here is a trick to split string in vector and take the first part of the string.
1
| y <- sapply(strsplit(x, ":"), "[", 1)
|