Create an empty data.frame

前端 未结 17 1063
猫巷女王i
猫巷女王i 2020-11-22 16:06

I\'m trying to initialize a data.frame without any rows. Basically, I want to specify the data types for each column and name them, but not have any rows created as a result

17条回答
  •  無奈伤痛
    2020-11-22 16:33

    You can do it without specifying column types

    df = data.frame(matrix(vector(), 0, 3,
                    dimnames=list(c(), c("Date", "File", "User"))),
                    stringsAsFactors=F)
    

提交回复
热议问题