In R, every time you read data in or write data out, you are using a connection behind the scenes. Connections abstract away the underlying implementation so that you can read and write data the same way, regardless of whether you’re writing to a file, an HTTP connnection, a pipe, or something more exotic.
- default connections: stdin, stderr, stdout
- survey of base connections: file, compressed file, url, pipe, socket, text
- important packages: curl
- blocking vs non-blocking
on.exit()if you opened
9.2 Reading and writing binary data
- text vs binary (newlines and nulls)
9.3 Reading and writing text data
Reading and writing text is more complicated than reading and writing binary data because as soon as you move beyond regular ASCII characters (e.g. a-z, 0-9) there are many different ways of representing the same text. The way in which text data is stored in binary is known as the encoding.
- in general vs
- converting with iconv
- UTF-8 everywhere
- Reliably reading and writing UTF-8