Comments (6)
//To determine: which option is better/more logical/etc
strsplit("lalal","l")
[[1]]
[1] "" "a" "a"
//or
stri_split("lalal","l")
[[1]]
[1] "" "a" "a" ""
// The R developers are aware of this:
// Note that final empty strings are not produced:
strsplit(paste(c("", "a", ""), collapse="#"), split="#")[[1]]
// [1] "" "a"
//But why the last empty space is treated less serious? If we get first empty space, why not last one too?
--edit--
str_split works like this:
str_split("lalal","l")
[[1]]
[1] "" "a" "a" ""
//added one line into stri_split, so now it works like strsplit (if last element of character vector is "" it won't be returned)
from stringi.
maybe we could omit all empty strings by default, but also introduce an option that forces leaving them as they are?
from stringi.
stri_split(NA_character_,"A")
[[1]]
[1] "N" ""
TODO: correct this wrong behavior
from stringi.
Please note that str_split has additional, very useful argument: n
- it returns a matrix with n columns :-)
from stringi.
`> str_split(c("ala","ma kota"),"a",2)
[[1]]
[1] "" "l"
[[2]]
[1] "m" " kot" `
Nope, it's still list.
That won't be so hard to do. I'll do this tomorrow :)
from stringi.
DONE yesterday :>
from stringi.
Related Issues (20)
- stri_detect_regex gives non-intuitive error (U_ILLEGAL_ARGUMENT_ERROR) with strings longer than 858993457 characters HOT 1
- `stri_(any|all)_(regex|fixed)` HOT 1
- stri_split_boundaries() returns slightly different tokens when the ICU rules are supplied HOT 3
- [Feature] Convert String to Code Points HOT 2
- [Feature] Extract Non-ASCII Characters HOT 3
- Unable to install stringi in R 4.3 HOT 10
- install issue, no internet HOT 2
- Behavior of `stri_sub()` when `from = 0` HOT 2
- Cannot install stringi on linux (CENTOS 7) machine HOT 1
- installation of package 'stringi' had non-zero exit status HOT 2
- Fails to build with clang on Windows HOT 2
- Calling stringi C functions without Rcpp HOT 2
- Installation fails on Apple Silicon M1
- Possibly unintentional breakage on 32 bit Windows and R 3.6 HOT 7
- PKG_CPPFLAGS should take precendence over CPPFLAGS in configure
- stringi needs compilation HOT 1
- Feature request: allow counting blank space at end of last line in `stri_wrap()`
- Feature request: stri_replace_*_regex pattern is a column name, replacement a $1 HOT 6
- Compilation errors on R-devel HOT 3
- Compilation failed after loading my .Rprofile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stringi.