Last active
August 29, 2015 14:04
-
-
Save vsbuffalo/fdc8e336abd666c48391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Factors are more memory efficient (if labels > few bytes), since redundant multi-byte | |
# labels are stored once in memory (as attributes), and integers keep the mapping. E.g.: | |
a = sample(paste0("chrom", c(1:22, "X", "Y")), 1e8, replace=TRUE) | |
object.size(a) | |
# 800001192 bytes | |
object.size(factor(a)) | |
# 400001744 bytes | |
# For long character vectors of repeating values, this *really* pays off. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment