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

Jan Kacaba jan.kacaba at gmail.com
Sun May 1 19:53:48 CEST 2016


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]]



More information about the R-help mailing list