R define dimensions of empty data frame

前端 未结 11 1141
清歌不尽
清歌不尽 2020-12-12 21:34

I am trying to collect some data from multiple subsets of a data set and need to create a data frame to collect the results. My problem is don\'t know how to create an empt

11条回答
  •  一向
    一向 (楼主)
    2020-12-12 22:19

    Here a solution if you want an empty data frame with a defined number of rows and NO columns:

    df = data.frame(matrix(NA, ncol=1, nrow=10)[-1]
    

提交回复
热议问题