[R] inserting row(column) in array or dataframe at specified row(column)

Tom Wright tom at maladmin.com
Sun May 1 20:59:45 CEST 2016

If you can address your columns by name then order shouldn't matter. If the
column order does matter, perhaps a matrix is a better structure to use?

On Sun, May 1, 2016, 10:56 AM Jan Kacaba <jan.kacaba at gmail.com> wrote:

> Hello dear R users,
> Is there a function or package which can insert row, column or array in
> another array at specified place (row or column)?
> I have made several attempts at this function optimizing both speed, code
> readability and ease of use. The functions are of following format:
> appcol=function(original_array, inserted_object, column_number,
> overwrite=FALSE)
> # If overwrite=TRUE the columns after column_number are ovewritten by
> inserted_object else the columns after column_number are shifted.
> Now I have started using package dplyr and it seams that there is no
> inserting function either. One can only append at the end or at the
> beginning of tbl_df. Is it true?
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list