Building on the what we were discussing in the comments above, here is an example that you should be able to reproduce. Be sure to save all of your work first, because this example deletes the objects in your current workspace.
## SAVE ANY WORK YOU NEED TO BEFORE DOING THIS!
##
## Start with a clean workspace
##
rm(list=ls())
ls()
set.seed(1)
## Make up some data
A = rnorm(10000)
B = sample(letters, 10000, replace=TRUE)
C = matrix(50000, nrow=10000, ncol=5)
## The same data as a data.frame
temp.df = data.frame(A = A)
temp.df$B = B
temp.df$C = C
## The same data as a list
temp.list = list(A, B, C)
##
## How big is each object?
##
sort( sapply(ls(), function(x) { object.size(get(x)) }) )
# A B C temp.list temp.df
# 80040 81288 400200 561600 562304
sum(sort( sapply(ls(), function(x) { object.size(get(x)) }) )[1:3])
# [1] 561528
You can see that the difference in size is marginal, whether you are collecting your objects as a list
(recommended) or a data.frame
(not recommended for practical purposes, though a data.frame
is a list
with a class
of data.frame
.
See also: here and here.