[R] Does replacing some values of a zoo object by NA reduce it's size ?

Allan Engelhardt allane at cybaea.com
Tue Sep 27 09:19:00 CEST 2011


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.



More information about the R-help mailing list