Here is how I can do that:
df <- data.frame(a=1:200)
df$a <- NULL
df
Result:
data frame with 0 columns and 200 rows
Can the same be achieved with only one command?
Here is how I can do that:
df <- data.frame(a=1:200)
df$a <- NULL
df
Result:
data frame with 0 columns and 200 rows
Can the same be achieved with only one command?
This can work (if the call to 2 functions is not considered 2 commands):
data.frame(matrix(, nrow=200, ncol=0))
#data frame with 0 columns and 200 rows
Edit: Another option is data.frame()[1:200, ]
:
data.frame()[1:200, ]
# data frame with 0 columns and 200 rows
This is what I discovered via dput
:
structure(
list(),
.Names = character(0),
row.names = c(NA, -200L),
class = "data.frame"
)