It seems there is a bug in rbind() related to row numbering. To reproduce the bug, please run the code below.
Whenever an empty dataframe is used as the first argument in rbind(), the variable cfg.df gets assigned row number "2" for the first added row, instead of "1".
Afterwards, rbind() assigns row number "21" instead of "2" for the second row.
If you keep adding rows till you get 21 rows,
rbind() will create row number 211 instead of "21".
Even if this behavior is intended to preserve the uniqueness of row names, there is a definite inconsistency with trying to use row number "2" twice in the beginning (with the second attempt resulting in "21", possibly to maintain the uniqueness of the row).
Unsystematic row numbering will be a cause of wasted time, because one automatically perceives this 'feature' as a bug in one's code or in R.
# run the code below to demonstrate the bug
addCfgLine <- function(conf.df, param=NULL, paramvalue=NULL)
# check that param & paramvalue are both != NULL
savedNames <- names(conf.df)
ttmp.df <- rbind( conf.df
return( ttmp.df )
cfg.df <- data.frame( param=character()
cfg.df <- addCfgLine(cfg.df, "option1_name", "DEFAULT_01")
cfg.df <- addCfgLine(cfg.df, "option2_name", "DEFAULT_02")
This can be closed; was fixed with R version 3.3.0; perhaps related to https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16570 or https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16666