title: Read in an RDS file from memory using aws.s3
body: <p>I am using the cloudy r aws.s3 code to pull down an RDS file from s3.  I have my own custom R runtime in a lambda.  aws.s3 has a handy method called s3readRDS("s3://pathtoyourfile").  This works well, but has a limitation in that it saves the RDS file to disk, then must read it back in using readRDS.  This is fine for smaller files, but for larger files, there is a no-go as we have limited disk storage.  </p>
  
  <p>Right now, I'm kind of stuck with these largish data files and the ability to pull them out into a database is just not feasible at the moment due to the target group, so I'm trying to minimize our cost and maximize throughput and this is the last nail in that coffin.</p>
  
  <p>According to the documentation:
  "Some users may find the raw vector response format of \code{get_object} unfamiliar. The object will also carry attributes, including \dQuote{content-type}, which may be useful for deciding how to subsequently process the vector. Two common strategies are as follows. For text content types, running \code{\link[base]{charToRaw}} may be the most useful first step to make the response human-readable. Alternatively, converting the raw vector into a connection using \code{\link[base]{rawConnection}} may also be useful, as that can often then be passed to parsing functions just like a file connection would be. "  </p>
  
  <p>Based on this(and an example using load()) the below code looks like it should work but it does not.</p>
  
  <pre><code>foo &lt;- readRDS(rawConnection(get_object("s3://whatever/foo.rds")))
  
  Error in readRDS(rawConnection(get_object("s3://whatever/foo.rds",  : 
    unknown input format
  </code></pre>
  
  <p>I can't seem the datastream right for readRDS or unserialize to make sense of it.  I know the file is correct as using the save to disk/load from disk works fine.  But I want to know how to make "foo" into an unserialized object without the save/load.</p>