Instead of using the REST Api, you might try using PowerShell (which calls the REST API for you, and also takes care of Authentication, see below).
Googling "PowerShell and R" will give you lots of ways to do that.
To get PowerShell to query lists from SharePoint Online (much harder than for SharePoint On-Premises), do the following:
1.) Install SharePoint Online Management Shell (https://www.microsoft.com/en-us/download/details.aspx?id=35588) so you can run PowerShell commands
This will allow you to run PowerShell commands against SharePoint online
2.) Install the SharePoint Client Components, http://www.microsoft.com/en-us/download/details.aspx?id=42038 (so we can load the SharePoint CSOM libraries; note that SharePoint Online's PowerShell doesn't give you much)
3.) Run the SharePoint Online Management shell, and enter the following:
# got some great ideas from these sites:
# http://www.hartsteve.com/2013/06/sharepoint-online-powershell/
# https://community.qlik.com/thread/143906
# https://karinebosch.wordpress.com/2012/02/03/caml-and-the-client-object-model/)
# Load the SharePoint Client Components which you installed
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
# Authenticate - can automate this so you don't have to enter password manually
# Note the .sharepoint.com
$siteUrl = “https://prandur.sharepoint.com”
$password = Read-Host -Prompt "Enter password" -AsSecureString
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
# note the .onmicrosoft.com; change this if you've correctly setup a domain for your SharePoint Online
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("[email protected]", $password)
$ctx.Credentials = $credentials
# Get the list you are interested in; change name as appropriate
$list = $ctx.get_web().get_lists().getByTitle("Documents")
$ctx.Load($list)
$ctx.ExecuteQuery()
# Print out the title, so we know we got the list
$list.Title;
# Create a CAML query to get the items and fields you want
# Lots of possibilities here for specifying filters and fields you want
$caml = new-object Microsoft.SharePoint.Client.CamlQuery
$caml.ViewXML = "<View />"
# Now, actually get the items
$items = $list.GetItems($caml)
# May need to do some additional loading tricks if you need some of the non-default fields
$ctx.Load($items)
$ctx.ExecuteQuery()
# now, print some info about each item (or have your R code do something with each item)
foreach($item in $items)
{
$item["FileLeafRef"]
}