I would like to create a data.frame in R with m (a variable) number of columns (for example 30), and 2 rows and fill all the values in the data.frame initially with 0\'s. It see
Does m really need to be a data.frame() or will a matrix() suffice?
m
data.frame()
matrix()
m <- matrix(0, ncol = 30, nrow = 2)
You can wrap a data.frame() around that if you need to:
m <- data.frame(m)
or all in one line: m <- data.frame(matrix(0, ncol = 30, nrow = 2))
m <- data.frame(matrix(0, ncol = 30, nrow = 2))