How should I split and retain elements using strsplit?
问题 What a strsplit function in R does is, match and delete a given regular expression to split the rest of the string into vectors. >strsplit("abc123def", "[0-9]+") [[1]] [1] "abc" "" "" "def" But how should I split the string the same way using regular expression, but also retain the matches? I need something like the following. >FUNCTION("abc123def", "[0-9]+") [[1]] [1] "abc" "123" "def" Using strapply("abc123def", "[0-9]+|[a-z]+") works here, but what if the rest of the string other than the