DataFrames.jl icon indicating copy to clipboard operation
DataFrames.jl copied to clipboard

Add `insert!`

Open pdeffebach opened this issue 4 years ago • 4 comments

Now that we have coalesced around a DataFrame being a collection of rows, other than a few notable exceptions, we should add an insert! method

insert!(df, row)

where row matches anything that can be push!ed to a DataFrame.

pdeffebach avatar Sep 21 '20 16:09 pdeffebach

Context: I'm using xtable in R to make a data-frame that can be outputted to a publication-quality table using dplyr. So I have to be very particular about the order of rows etc. This seems hard to do in R and maybe we can make peoples' lives easier in Julia.

pdeffebach avatar Sep 21 '20 16:09 pdeffebach

Yes it is not a problem to add it. There is a bunch of similar functions waiting to be added. But we treat this as non critical for 1.0 release. Of course is someone wants to make a PR it is welcome.

bkamins avatar Sep 21 '20 20:09 bkamins

insert!(df, row)

Shouldn't that be the following?

insert!(df, i, row)

Otherwise it would be the same as push!.

CameronBieganek avatar Jan 29 '21 17:01 CameronBieganek

x-ref #2936

bkamins avatar Nov 22 '21 18:11 bkamins

added

bkamins avatar Dec 04 '22 14:12 bkamins