> I think this is just because you picked short strings. If the factor
> is mapping the string to a native integer type, the strings would have
> to be larger for you to notice:
>
>> object.size(sample(c("a pretty long string", "another pretty long string"), 
>> 1000, replace=TRUE))
> 8184 bytes
>> object.size(factor(sample(c("a pretty long string", "another pretty long 
>> string"), 1000, replace=TRUE)))
> 4560 bytes

No, it's probably because you have an older version of R, which
doesn't have the global string cache.

> object.size(sample(c("a pretty long string", "another pretty long string"), 
> 1000, replace=TRUE))
4136 bytes
> object.size(factor(sample(c("a pretty long string", "another pretty long 
> string"), 1000, replace=TRUE)))
4344 bytes

Hadley

-- 
http://had.co.nz/

______________________________________________
R-help@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.

Reply via email to