Skip to content

Query about memory used in list and dataframe

3 messages · Shivam, jim holtman, Rui Barradas

#
I think you really have to show use your exact code that you did along
with an 'str' of each intermediate data structure since my quick test
does not bear out what you were saying:
+     , a7=1:6, a8 = 1:6, a9 = 1:6, a10 = 1:6, a11 = 1:6, a12 = 1:6)
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12
1  1  1  1  1  1  1  1  1  1   1   1   1
2  2  2  2  2  2  2  2  2  2   2   2   2
3  3  3  3  3  3  3  3  3  3   3   3   3
4  4  4  4  4  4  4  4  4  4   4   4   4
5  5  5  5  5  5  5  5  5  5   5   5   5
6  6  6  6  6  6  6  6  6  6   6   6   6
2264 bytes
2264 bytes
1032 bytes
1032 bytes
2264 bytes

        
On Sat, May 5, 2012 at 5:50 PM, Shivam <shivamsingh at gmail.com> wrote:

  
    
#
Hello,

Also, note that to rbind data frames, like the op says, takes less memory
than to cbind.


x <- 1:6
list.1 <- list(x,x,x,x,x,x,x,x,x,x,x,x)
test.df3 <- as.data.frame(do.call(cbind, list.2))
test.df4 <- as.data.frame(do.call(rbind, list.2))

object.size(list.1)
object.size(test.df3)
object.size(test.df4)

(More columns == more variables == more memory.)

Rui Barradas


jholtman wrote
--
View this message in context: http://r.789695.n4.nabble.com/Query-about-memory-used-in-list-and-dataframe-tp4611896p4612876.html
Sent from the R help mailing list archive at Nabble.com.