What are big vectors in RStudio?

Using RStudio:

a <- rep(1, 1e4)
b <- rep(1, 1e5)

In the environment area aand are bdisplayed differently:

enter image description here

What does it mean Large numeric? I used to think that this means that bR is processed in a special way, but with the help strI do not see anything special. I also read about long vectors , but it looks like it's only about vectors with a length> = 2 ^ 31.

Is this a purely informative comment added by RStudio to notify the user that the memory size of the object is greater than an arbitrary limit?

+4
source share
1 answer

It looks like a qualifier for objects larger than half MB. See line 460 here .

  # for large objects (> half MB), don't try to get the value, just show
  # the size. Some functions (e.g. str()) can cause the object to be
  # copied, which is slow for large objects.
  if (size > 524288)
  {
     len_desc <- if (len > 1) 
               paste(len, " elements, ", sep="")
            else 
               ""
     # data frames are likely to be large, but a summary is still helpful
     if (is.data.frame(obj))
     {
        val <- "NO_VALUE"
        desc <- .rs.valueDescription(obj)
     }
     else
     {
        val <- paste("Large ", class, " (", len_desc, 
                     capture.output(print(size, units="auto")), ")", sep="")
     }
     contents_deferred <- TRUE
  }

str() , .

paste("Large", ...) .

:

small <- 1:131050
large <- 1:132000

object.size(small)
# 524240 bytes
object.size(large)
# 528040 bytes
+2

Source: https://habr.com/ru/post/1688457/


All Articles