New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add str_select which works as grep with value=T #21

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@jiho

jiho commented Sep 12, 2012

The code is actually based on str_detect at the moment. It could wrap grep if
this is preferred.

Add str_select which works as grep with value=T
The code is actually based on str_detect at the moment.
It could wrap grep if this is preferred.
@jiho

This comment has been minimized.

jiho commented Sep 1, 2014

Any chance of getting this in? I am using x[which(str_detect(x, ...))] more than I can count.

@matthieugomez

This comment has been minimized.

matthieugomez commented Sep 16, 2014

Do you really need which?

string[str_detect(string,pattern)]  
@jiho

This comment has been minimized.

jiho commented Sep 17, 2014

Yes because:

str_detect(c(NA, "abc"), "a")

gives NA and which eliminates those.

@matthieugomez

This comment has been minimized.

matthieugomez commented Sep 17, 2014

Thanks!

@hadley

This comment has been minimized.

Member

hadley commented Nov 26, 2014

@gagolews do you think this would be useful for stringi?

@jiho I'd prefer to use is.na(x) & x, but mostly sorry for taking so long to look at this.

@gagolews

This comment has been minimized.

Contributor

gagolews commented Nov 26, 2014

@hadley: Do you mean stri_subset_* here? Its already there (?)

@hadley

This comment has been minimized.

Member

hadley commented Nov 27, 2014

Oops, missed that. I'll add a wrapper!

@hadley

This comment has been minimized.

Member

hadley commented Nov 27, 2014

Done!

@hadley hadley closed this Nov 27, 2014

@jiho

This comment has been minimized.

jiho commented Dec 8, 2014

Thanks for the regain of activity on stringr! I did not know about stringi, it looks cool. The packages seem very similar now. Notwithstanding company policies (RStudio vs. Rexamine), wouldn't it save you both a lot of time to just merge them? Having several packages that do almost the same thing is also an aspect of R which is difficult for new / unconfident users. Anyhow, thanks for the work.

@hadley

This comment has been minimized.

Member

hadley commented Dec 9, 2014

@jiho two main reasons:

  • Updating stringr gives every existing stringr user a big performance boost
  • stringi is more of a developer library - I think it provides so many options that it would be overwhelming to a new user. So stringr provides a simple high-level API that glosses over some of the details in the interest of simplify, where stringi dives deep, giving you the ability to do anything you could ever imagine.
@jiho

This comment has been minimized.

jiho commented Dec 12, 2014

@hadley thanks for the info. I'll surely continue to use stringr since I am comfortable with it and most of my code uses it. I was just wondering wether it was OK for stringi to be "relegated" to work behind the scene in that configuration, the ICU core might as well be integrated into stringr directly, adding some new functions for the complex aspects.

But anyhow, as a stringr-only user, I'm happy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment