I have a data frame from which I want to delete all rows while maintaining the original structure (columns).
ddf vint1 vint2 vfac1 vfac2 1 9 10 1 3 2 9 6 3 4 3 6 2 2 2 4 10 6 2 4 5 7 12 3 2 > > > > dput(ddf) structure(list(vint1 = c(9L, 9L, 6L, 10L, 7L), vint2 = c(10L, 6L, 2L, 6L, 12L), vfac1 = structure(c(1L, 3L, 2L, 2L, 3L), .Label = c("1", "2", "3"), class = "factor"), vfac2 = structure(c(2L, 3L, 1L, 3L, 1L), .Label = c("2", "3", "4"), class = "factor")), .Names = c("vint1", "vint2", "vfac1", "vfac2"), class = "data.frame", row.names = c(NA, -5L))
I did my best:
ddf = NA for(i in 1:nrow(ddf) ddf[i,] = NULL
but they do not work. Thank you for your help on this basic subject.