R object of data.frame and data.table have same type?

前端 未结 2 990
伪装坚强ぢ
伪装坚强ぢ 2020-12-21 11:59

I am still very new to R and recently came across something I am not sure what it means. data.frame and data.table have same type? Can an object ha

2条回答
  •  囚心锁ツ
    2020-12-21 12:43

    Data.table and data.frame are different classes, but they are related through inheritance. Data.table inherits from data.frame, and basically expands its capabilities. You can also see that after converting cars to the data.table class:

    R> typeof(cars)
    [1] "list"      # similar to dataframe
    
    R> mode(cars)
    [1] "list"      # idem
    

    More information here or just google for "inheritance".

提交回复
热议问题