Read/write in s3 bucket using R and IAM

Hello everyone,

I have an issue, and I need some guidance.
I am unfamiliar with R and have to do a project with R.

My main problem is that I have an IAM role and would like to read and write in a s3 bucket.
How is this possible with R using the IAM Role? I can't find a solution on the internet.

Thanks in advance for your answers.