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

More along functions? #122

Closed
hadley opened this issue Nov 6, 2015 · 1 comment
Closed

More along functions? #122

hadley opened this issue Nov 6, 2015 · 1 comment

Comments

@hadley
Copy link
Member

hadley commented Nov 6, 2015

I wonder if it would be useful to have:

list_along <- function(x) {
  vector("list", length(x)
}

rep_along <- function(x, y) {
   rep(x, length.out = length(y))
}

I find myself reaching for those functions (by analogy to seq_along()) fairly frequently

@hadley
Copy link
Member Author

hadley commented Nov 6, 2015

Could take multiple arguments and throw an error if they're not the same length?

@hadley hadley closed this as completed in 80c204a Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant