Starting from this data frame:
my.df <- data.frame(num = 1:5, let = letters[1:5])
> my.df
num let
1 1 a
2 2 b
3 3 c
4 4 d
5 5 e
>
and inserting a blank row (NAs row) for each one of my.df rows.
na.df <- data.frame(num = NA, let = NA)
my.df <- do.call(rbind, apply(my.df, 1, function(x) {rbind(x, na.df)}))
> my.df
num let
1 1 a
2 <NA> <NA>
3 2 b
4 <NA> <NA>
5 3 c
6 <NA> <NA>
7 4 d
8 <NA> <NA>
9 5 e
10 <NA> <NA>
--
Best,
GG
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.