One purpose of MRAN was to distribute Microsoft R Open, which was discontinued in 2021. MRAN has also served since 2014 as the repository of a daily archive of CRAN packages. Some R users may still be using these static CRAN snapshots as a default CRAN repository for R scripts either directly, via the checkpoint package, or via older images of the rocker/r-ver container. If this affects you, you will need to find or create a new source of the package archive before MRAN's retirement.
The blog post linked below recommends using the miniCRAN package to download and save the package archives, a process documented in detail on Microsoft Learn. Commercial users of RStudio may also wish to explore the Posit Package Manager product from the creators of RStudio.
I’m very happy to announce Microsoft365R, a package for working with the Microsoft 365 (formerly known as Office 365) suite of cloud services. Microsoft365R extends the interface to the Microsoft Graph API provided by the AzureGraph package to provide a lightweight yet powerful interface to SharePoint and OneDrive, with support for Teams and Outlook soon to come.
Microsoft365R is now available on CRAN, or you can install the development version from GitHub with devtools::install_github("Azure/Microsoft365R").
Authentication
The first time you call one of the Microsoft365R functions (see below), it will use your Internet browser to authenticate with Azure Active Directory (AAD), in a similar manner to other web apps. You will get a dialog box asking for permission to access your information.
Microsoft365R is registered as an app in the “aicatr” AAD tenant. Because it needs read/write access to groups and SharePoint sites, you’ll need an admin to grant it access to your tenant. Alternatively, if the environment variable CLIMICROSOFT365_AADAPPID is set, Microsoft365R will use its value as the app ID for authenticating; or you can specify the app ID as an argument when calling the functions below. See also this issue at the GitHub repo for some possible workarounds.
OneDrive
To access your personal OneDrive, call the personal_onedrive() function, and to access OneDrive for Business call business_onedrive(). Both functions return an R6 client object of class ms_drive, which has methods for working with files and folders. Note that OneDrive for Business is technically part of SharePoint, and requires a Microsoft 365 Business subscription.
od <- personal_onedrive()
odb <- business_onedrive(tenant="mycompany")
# use the device code authentication flow in RStudio Server
od <- personal_onedrive(auth_type="device_code")
# list files and folders
od$list_items()
od$list_items("Documents")
# upload and download files
od$download_file("Documents/myfile.docx")
od$upload_file("somedata.xlsx")
# create a folder
od$create_folder("Documents/newfolder")
You can open a file or folder in your browser with the open_item() method. For example, a Word document or Excel spreadsheet will open in Word or Excel Online, and a folder will be shown in OneDrive.
od$open_item("Documents/myfile.docx")
You can get and set the metadata properties for a file or folder with get_item_properties() and set_item_properties(). For the latter, provide the new properties as named arguments to the method. Not all properties can be changed; some, like the file size and last modified date, are read-only. You can also retrieve an object representing the file or folder with get_item(), which has methods appropriate for drive items.
od$get_item_properties("Documents/myfile.docx")
# rename a file -- version control via filename is bad, mmkay
od$set_item_properties("Documents/myfile.docx", name="myfile version 2.docx")
# alternatively, you can call the file object's update() method
item <- od$get_item("Documents/myfile.docx")
item$update(name="myfile version 2.docx")
SharePoint
To access a SharePoint site, use the sharepoint_site() function and provide the site URL or ID.
site <- sharepoint_site("https://myaadtenant.sharepoint.com/sites/my-site-name")
The client object has methods to retrieve drives (document libraries) and lists. To show all drives in a site, use the list_drives() method, and to retrieve a specific drive, use get_drive(). Each drive is an object of class ms_drive, just like the OneDrive clients above.
# list of all document libraries under this site
site$list_drives()
# default document library
drv <- site$get_drive()
# same methods as for OneDrive
drv$list_items()
drv$open_item("teamproject/plan.xlsx")
To show all lists in a site, use the get_lists() method, and to retrieve a specific list, use get_list() and supply either the list name or ID.
site$get_lists()
lst <- site$get_list("my-list")
You can retrieve the items in a list as a data frame, with list_items(). This has arguments filter and select to do row and column subsetting respectively. filter should be an OData expression provided as a string, and select should be a string containing a comma-separated list of columns. Any column names in the filter expression must be prefixed with fields/ to distinguish them from item metadata.
# return a data frame containing all list items
lst$list_items()
# get subset of rows and columns
lst$list_items(
filter="startsWith(fields/firstname, 'John')",
select="firstname,lastname,title"
)
Finally, you can retrieve subsites with list_subsites() and get_subsite(). These also return SharePoint site objects, so all the methods above are available for a subsite.
Future plans
Currently, Microsoft365R supports OneDrive and SharePoint Online; future updates will add the ability to post to Teams channels and send emails via Outlook. You can also provide feedback and make feature requests by opening an issue at the repo, or by emailing me at hongooi73 (@) gmail.com.
The R Core Team has released R 4.0.3 (codename: "Bunny-Wunnies Freak Out"), the latest update to the R statistical computing system. This is a minor update to the R 4.0.x series, and so should not require any changes to existing R 4.0 scripts or packages. It is available for download for Windows, Mac and Linux systems from your local CRAN mirror.
This release includes minor improvements and bug fixes including improved timezone support on MacOS, improved labels on dot charts, better handling of large tables for Fisher's Exact Test and Chi-Square tests, and control over timeouts for internet connections.
For complete details on the R 4.0.3, check out the announcement linked below.
Microsoft R Open 4.0.2 has been released, combining the latest R language engine with multi-processor performance and tools for managing R packages reproducibly. You can download Microsoft R Open 4.0.2 for Windows,and Linux from MRAN now. Microsoft R Open is 100% compatible with all R version 4 scripts and packages, and works with all your favorite R interfaces and development environments.
This update brings R version 4 to Microsoft R Open for the first time. This update includes many new features for the R language and system, along with improved performance and memory usage. Note that you will need to install any R packages you wish to use with MRO 4.0.2. By default, MRO installs packages from a static CRAN snapshot taken on July 16 2020.
We hope you find Microsoft R Open useful, and if you have any comments or questions please visit the Microsoft R Open forum. You can follow the development of Microsoft R Open at the MRO GitHub repository. To download Microsoft R Open, simply follow the link below.
R 4.0.2 is now available for download for Windows, Mac and Linux platforms. This update addresses a few minor bugs included in the R 4.0.0 release, and also a significant bug introduced in R 4.0.1 on the Windows platform.
Compared to R 4.0.0, the R 4.0.2 update also improves the performance of the merge function, and adds an option to better handle zero-length arguments to the paste and paste0 functions.
For the details on the changes in R 4.0.2 follow the link below, and visit your local CRAN mirror to download the update.
As the version number bump suggests, this is a major update to R that makes some significant changes. Some of these changes — particularly the first one listed below — are likely to affect the results of R's calculations, so I would not recommend running scripts written for prior versions of R without validating them first. In any case, you'll need to reinstall any packages you were using for R 4.0.0. (You might find this R script useful for checking what packages you have installed for R 3.x.)
Imported string data is no long converted to factors. The stringsAsFactors option, which since R's inception defaulted to TRUE to convert imported string data to factor objects, is now FALSE. This default was probably the biggest stumbling block for prior users of R: it made statistical modeling a little easier and used a little less memory, but at the expense of confusing behavior on data you probably thought was ordinary strings. This change broke backward compatibility for many packages (mostly now updated on CRAN), and likely affects your own scripts unless you were diligent about including explicit stringsAsFactors declarations in your import function calls.
A new syntax for specifying raw character strings. You can use syntax like r"(any characters except right paren)" to define a literal string. This is particularly useful for HTML code, regular expressions, and other strings that include quotes or backslashes that would otherwise have to be escaped.
An enhanced reference counting system. When you delete an object in R, it usually releases the associated memory back to the operating system. Likewise, if you copy an object with y <- x, R won't allocate new memory for y unless x is later modified. In prior versions of R, however, that system breaks down if there are more than 2 references to any block of memory. Starting with R 4.0.0, all references will be counted, and so R should reclaim as much memory as possible, reducing R's overall memory footprint. This will have no impact on how you write R code, but this change make R run faster, especially on systems with limited memory and with slow storage systems.
Normalization of matrix and array types. Conceptually, a matrix is just a 2-dimensional array. But prior versions of R handle matrix and 2-D array objects differently in some cases. In R 4.0.0, matrix objects will formally inherit from the array class, eliminating such inconsistencies.
A refreshed color palette for charts. The base graphics palette for prior versions of R (shown as R3 below) features saturated colors that vary considerably in brightness (for example, yellow doesn't display as prominently as red). In R 4.0.0, the palette R4 below will be used, with colors of consistent luminance that are easier to distinguish, especially for viewers with color deficiencies. Additional palettes will make it easy to make base graphics charts that match the color scheme of ggplot2 and other graphics systems.
R version 4 represents a major milestone in the history of R. It's been just over 20 years since R 1.0.0 was released on February 29 2000, and the history of R extends even further back than that. If you're interested in the other major milestones, I cover R's history in this recent talk for the SatRDays DC conference.
For the details on the R 4.0.0 release, including the complete list of changes, check out the announcement at the link below.
On February 29, R 3.6.3 was released and is now available for Windows, Linux and Mac systems. This update, codenamed "Holding the Windsock", fixes a few minor bugs, and as a minor update maintains compatibility with scripts and packages written for prior versions of R 3.6.
February 29 is an auspicious date, because that was the day that R 1.0.0 was released to the world: February 29, 2000. In the video below from the CelebRation2020 conference marking the 20th anniversary of R, core member Peter Dalgaard reflects on the origins of R, and releases R 3.6.3 live on stage (at the 33-minute mark).
R has advanced tremendously in the last 20 years, and the R language and the community around it shows no signs of slowing down, as demonstrated by this chart of R package downloads (from Jozef Hajnala's excellent retrospective on R).
R 3.6.3 is likely to be the last update in the R 3.6 series, before R 4.0.0 is released on April 24 with many exciting new features. For more on R 3.6.3, including all the changes in this release, check out the official announcement on the link below.
But big changes are coming to R with version 4.0.0, which is expected to be released not long after R's official 20th birthday on February 29, 2020. (The CelebRation 2020 conference will mark the occasion in Copenhagen.) The R Core team has announced previews of some of the changes, which include:
An enhanced reference counting system. When you delete an object in R, it will usually releases the associated memory back to the operating system. Likewise, if you copy an object with y <- x, R won't allocate new memory for y unless x is later modified. In current versions of R, however, that system breaks down if there are more than 2 references to any block of memory. Starting with R 4.0.0, all references will be counted, and so R should reclaim as much memory as possible, reducing R's overall memory footprint. This will have no impact on how you write R code, but this change make R run faster, especially on systems with limited memory and with slow storage systems.
Normalization of matrix and array types. Conceptually, a matrix is just a 2-dimensional array. But current versions of R handle matrix and 2-D array objects differently in some cases. In R 4.0.0, matrix objects will formally inherit from the array class, eliminating such inconsistencies.
A refreshed color palette for charts. The base graphics palette for current versions of R (shown as R3 below) features saturated colors that vary considerably in brightness (for example, yellow doesn't display as prominently as red). In R 4.0.0, the palette R4 below will be used, with colors of consistent luminance that are easier to distinguish, especially for viewers with color deficiencies. Additional palettes will make it easy to make base graphics charts that match the color scheme of ggplot2 and other graphics systems.
Many other smaller changes are in the works too. See the NEWS file for the upcoming R release for details.
A new R package azuremlsdk (available to install from Github now, and from CRAN soon), provides the interface to the Azure Machine Learning service. With R functions, you can provision new computing clusters in Azure, and use those to train models with R and deploy them as prediction endpoints for use from any app. You can also launch R-based notebooks in the new Azure Machine Learning studio web interface, or even launch a complete RStudio server instance on your cloud computing resources. Azure Machine Learning service supports the latest version of R (3.6.1) and all R packages (from CRAN, Github, or elsewhere). The video below from The AI Show demonstrates how it all works:
Azure Machine Learning is also great for teams that have both Python and R expertise. You can even call Python models from R (and vice-versa): in this Ignite 2019 talk (presented by me and Daniel Schneider) we deploy R and Python function as a container services, and call them both from a Shiny app. You can also find the slides and associated code from that talk in this Github repository.
Microsoft Machine Learning Server, the enhanced deployment platform for R and Python applications, has been updated to version 9.4. This update includes the open source R 3.5.2 and Python 3.7.1 engines, and supports integration with Spark 2.4. Microsoft ML Server also includes specialized R packages and Python modules focused on application deployment, scalable machine learning, and integration with SQL Server.