Dear R developers
Would you consider adding a 'data.frame' method for the base::rep
function? The need to replicate a df row-wise can easily arise while
programming, and rep() is unable to handle such a case. See below.
$Sepal.Length
[1] 5.1
$Sepal.Width
[1] 3.5
$Petal.Length
[1] 1.4
$Petal.Width
[1] 0.2
$Species
[1] setosa
Levels: setosa versicolor virginica
$Sepal.Length
[1] 5.1
$Sepal.Width
[1] 3.5
$Petal.Length
[1] 1.4
$Petal.Width
[1] 0.2
$Species
[1] setosa
Levels: setosa versicolor virginica
I found a 'rep.data.frame' function in package 'mefa' [2], but I think
it would be nice to have it in base R. In any case, the code used by
the method is very simple.