1

What is the difference between nchar and object.size?

Sample below: 
nchar("TestData", type="bytes")
8
format(object.size("TestData"), units = "b")
"104 bytes"
eclairs
  • 1,515
  • 6
  • 21
  • 26
  • 4
    Related: [Understanding object.size() versus nchar()](https://stackoverflow.com/questions/25394444/understanding-object-size-versus-nchar); "_object size doesn't tell you how many bytes the data is actually taking up, it just tells you how many bytes have been set aside_" – Henrik May 02 '18 at 10:13
  • 2
    See also [hadley on object size](http://adv-r.had.co.nz/memory.html#object-size) – Henrik May 02 '18 at 10:18
  • Thanks Henrik. Is there a way in R to limit the byte size of an object? i.e. if the object.size is currently 216, i want to create a value with only 64 bytes. – eclairs May 02 '18 at 10:25
  • 2
    It's unfortunately not entirely clear to me what you mean. Maybe post a new question on this topic, where you can provide a more thorough explanation with a small example. Cheers. – Henrik May 02 '18 at 10:30

0 Answers0