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

.id parameter for adply? #191

Closed
krlmlr opened this issue Jan 6, 2014 · 4 comments · Fixed by #240
Closed

.id parameter for adply? #191

krlmlr opened this issue Jan 6, 2014 · 4 comments · Fixed by #240

Comments

@krlmlr
Copy link

krlmlr commented Jan 6, 2014

Similar to #188, as suggested there.

> adply(matrix(1:4, nrow=2), 2, function(a) data.frame(a=a))
  X1 a
1  1 1
2  1 2
3  2 3
4  2 4
> adply(matrix(1:4, nrow=2), 1:2, function(a) data.frame(a=a))
  X1 X2 a
1  1  1 1
2  2  1 2
3  1  2 3
4  2  2 4

Dimension names would do better here (see #190), but an .id parameter could be used to specify a replacement for X or to drop these columns altogether.

@jennybc
Copy link

jennybc commented Dec 18, 2014

👍

I just marked 30+ assignment in my class and saw alot of gymnastics around the X1 phenomenon above.

Things that would be nice:

  • ability to suppress creation of X1
  • ability to supply a different name in the adply() call

As for the values of X1:

I frequently find myself self-naming the input array, i.e. foo <- c('a', 'b', 'c'); names(foo) <- foo to make X1 more immediately useful downstream (after renaming).

@hadley
Copy link
Owner

hadley commented Mar 30, 2015

I'd consider a pull request for this. (But needs to be in the next week or so)

@krlmlr
Copy link
Author

krlmlr commented Mar 30, 2015

I'll take a look. Are you interested in adding coverage analysis and linting?

@hadley
Copy link
Owner

hadley commented Mar 30, 2015

No, because I'd be horrified!

hadley added a commit that referenced this issue Apr 10, 2015
New argument .id to adply.

Fixes #191. Closes #239
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

Successfully merging a pull request may close this issue.

3 participants