Can someone clarify why typeof (data.frame) shows list in R? In contrast, class gives expected type. E.g., demonstrate that using the built-in data.frame mtcars.
> typeof(mtcars)
[1] "list"
> class(mtcars)
[1] "data.frame"
Any hints on how to use typeof versus class?
data.frame and data.table are both collections (lists) of items (vectors, if you will), each item of the same length (ie each column is an item in the list, internally to R anyway). This is why unlike in a matrix, columns can have different classes.
Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With