Why does an empty dataframe fail an is.null() test?

后端 未结 3 1164
清歌不尽
清歌不尽 2021-02-02 10:00

please excuse me if my question is quite basic. I created an empty data frame by df <- data.frame() and obviously the data frame is NULL (empty). when I try to

3条回答
  •  礼貌的吻别
    2021-02-02 10:34

    data.frame() creates an object that has a data frame class. Because the object exists, is.null will return FALSE. A NULL variable has no class and no contents.

提交回复
热议问题