key1 <- key[1:6000,,drop=F]
According to the documentation ?Extract.data.frame
fall: logical. If "TRUE" the result is forced to the lowest possible size. The default value is crash if only one Column is left, but is not discarded if only one row remains.
Or you can use subset, but usually it is a bit slower. Here row.names are numbers from 1to10000
key2 <- subset(key, as.numeric(rownames(key)) <6000)
is.data.frame(key2)
#[1] TRUE
because
subset(x, subset, select, drop = FALSE, ...)
source
share