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

Efficient way of creating a data frame from columns #376

Closed
hadley opened this issue Apr 9, 2014 · 4 comments
Closed

Efficient way of creating a data frame from columns #376

hadley opened this issue Apr 9, 2014 · 4 comments
Assignees
Labels
feature a feature request or enhancement
Milestone

Comments

@hadley
Copy link
Member

hadley commented Apr 9, 2014

i.e. so instead of

x <- runif(10)
data.frame(x = x, y = x * 2)

you could do

data_frame(x = runif(10), y = x * 2)

Would support standard dplyr features:

  • errors for non-supported vector types
  • only recycle vectors of length 1
  • one versions for ... input, one version of list input
  • fast!
@romainfrancois
Copy link
Member

That should be fun. I guess some of the tools of mutate can be reused for that.

@hadley hadley added this to the 0.3 milestone Jul 28, 2014
@hadley
Copy link
Member Author

hadley commented Jul 28, 2014

I'd really like to include this in the next version.

@hadley
Copy link
Member Author

hadley commented Jul 28, 2014

Two other notes:

  • it should always return an object of class tbl_df, data.frame
  • it should do minimal transformation on its inputs so that data.frame(list(1, 2, 3)) works (needs to check that vectors are all of same length, and matrices/arrays have first dim of correct length)

kevinushey added a commit to kevinushey/dplyr that referenced this issue Sep 4, 2014
kevinushey added a commit to kevinushey/dplyr that referenced this issue Sep 4, 2014
@hadley
Copy link
Member Author

hadley commented Sep 4, 2014

Done in cda0232

@hadley hadley closed this as completed Sep 4, 2014
krlmlr pushed a commit to krlmlr/dplyr that referenced this issue Mar 2, 2016
krlmlr pushed a commit to krlmlr/dplyr that referenced this issue Mar 2, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants