Ashim Kapoor
2011-Sep-27 06:00 UTC
[R] Does replacing some values of a zoo object by NA reduce it's size ?
Dear R-helpers, Please have a look at the following. f1 is the same as f2 except that it has some values replaced by NA. But it's corresponding file is slightly bigger than the file containing f2. Could someone please tell me if this is an anomaly ?> load("file1") > ls()[1] "f1"> load("file2") > ls()[1] "f1" "f2">> dput(f1)structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, NA, NA, NA, 2, 2, 2, NA, NA, NA, NA), .Dim = c(10L, 2L), .Dimnames = list(NULL, c("v1", "l1")), index = 1:10, class = "zoo")> dput(f2)structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), .Dim = c(10L, 2L), .Dimnames = list(NULL, c("v1", "l1")), index = 1:10, class = "zoo") -rw-r--r-- 1 ashimkapoor ashimkapoor 192 2011-09-27 11:08 file1 -rw-r--r-- 1 ashimkapoor ashimkapoor 179 2011-09-27 11:08 file2 Best Regards, Ashim. [[alternative HTML version deleted]]
Allan Engelhardt
2011-Sep-27 07:19 UTC
[R] Does replacing some values of a zoo object by NA reduce it's size ?
It is not an anomaly. The object is the same size (object.size(f1)==object.size(f2)); its file representation is different. On 27/09/2011 07:00, Ashim Kapoor wrote:> Dear R-helpers, > > Please have a look at the following. f1 is the same as f2 except that it has > some values replaced by NA. But it's corresponding file is slightly bigger > than the file containing f2. Could someone please tell me if this is an > anomaly ? > >> load("file1") >> ls() > [1] "f1" >> load("file2") >> ls() > [1] "f1" "f2" >> dput(f1) > structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, NA, NA, NA, 2, 2, > 2, NA, NA, NA, NA), .Dim = c(10L, 2L), .Dimnames = list(NULL, > c("v1", "l1")), index = 1:10, class = "zoo") >> dput(f2) > structure(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2), .Dim = c(10L, 2L), .Dimnames = list(NULL, c("v1", > "l1")), index = 1:10, class = "zoo") > > -rw-r--r-- 1 ashimkapoor ashimkapoor 192 2011-09-27 11:08 file1 > -rw-r--r-- 1 ashimkapoor ashimkapoor 179 2011-09-27 11:08 file2 > > Best Regards, > Ashim. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Possibly Parallel Threads
- Can someone please have a look at this query on stackoverflow?
- Can someone please have a look at this query on stackoverflow?
- SpreadLevelPlot for more than one factor
- Can someone please have a look at this query on stackoverflow?
- Can someone please have a look at this query on stackoverflow?