Skip to content
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

How do you bite rowwise? #97

Open
m3hdad opened this issue Mar 31, 2023 · 2 comments
Open

How do you bite rowwise? #97

m3hdad opened this issue Mar 31, 2023 · 2 comments
Labels
discussion Development direction idea to quarrel over

Comments

@m3hdad
Copy link

m3hdad commented Mar 31, 2023

I'm trying to bite() based on start (X7) and end(X8) columns but I cannot figure it out.
image

@ErdaradunGaztea
Copy link
Member

Hmm, since it's a data frame (perhaps a tibble, given the headers), I don't have any better idea than using dplyr and its rowwise():

library(dplyr)
data %>%
  rowwise() %>%
  mutate(sq_sub = bite(sq, seq(X7, X8))) %>%
  # optional
  ungroup()

Currently on the phone and away from any computer, so I cannot confirm whether it's working, hopefully me or Dominik can valisate it soon.

Side note, good to know that extracting a subsequence given by start and end indices is something people do, we were thinking of a function optimized for exactly this use case.

@ErdaradunGaztea ErdaradunGaztea added the discussion Development direction idea to quarrel over label Mar 31, 2023
@m3hdad
Copy link
Author

m3hdad commented Mar 31, 2023

Thanks Laura, did not work. bite() is really sensitive! and returns "it's not implemented for this type of object".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Development direction idea to quarrel over
Projects
None yet
Development

No branches or pull requests

2 participants