I have a input.Rdata file in a s3 bucket at a location say:
"s3://bucket1/rcode/data/input.Rdata"
There are multiple buckets and files in each folder, not just this one file.
Question:
- How to load this data from s3 in R given that I have the S3 location?
- How to save a .Rdata in s3 in R given that I have the S3 location?
I know that there is a library called "aws.s3". But I am new to R so not sure how to use it.
Also Please note that I would like to deploy the code in AWS lambda. So the code should be compatible with it.
Could Someone please help? Thanks in advance.
Try out the paws package. It basically is an AWS SDK for R.
To download files from AWS S3 you can check out the documentation: https://www.paws-r-sdk.com/docs/s3_download_file/
As long as you have your credentials set up (check out: https://www.paws-r-sdk.com/developer_guide/credentials/ or https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). This example should should work.
Note: if you are on linux try out the pre-built binaries for faster installation: https://www.paws-r-sdk.com/