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

Add after keyword argument to insertcols! #2613

Closed
CameronBieganek opened this issue Jan 29, 2021 · 2 comments · Fixed by #2829
Closed

Add after keyword argument to insertcols! #2613

CameronBieganek opened this issue Jan 29, 2021 · 2 comments · Fixed by #2829
Labels
feature non-breaking The proposed change is not breaking
Milestone

Comments

@CameronBieganek
Copy link

Currently you have to do this if you want to insert columns after a certain column:

df = DataFrame(a=1:2, b=3:4, c=5:6)
i = findfirst(==(:b), propertynames(df))
insertcols!(df, i+1, :x => 7:8)

It would be nice if there were a boolean keyword argument after which defaults to false.

@bkamins bkamins added this to the 1.x milestone Jan 29, 2021
@bkamins bkamins added feature non-breaking The proposed change is not breaking labels Jan 29, 2021
@bkamins
Copy link
Member

bkamins commented Jan 29, 2021

Note that you can just write columnindex(df, :b) + 1. Other than that it could be added in the future.

@pdeffebach
Copy link
Contributor

Re-ordering data more broadly is something Stata does really well. An after keyword is used heavily there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature non-breaking The proposed change is not breaking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants