Get the current operating system

Description

Returns the name of the current operating system in lowercase. This is a simple wrapper around Sys.info()[[“sysname”]].

Usage

system_os()

Details

This function is used with testthat’s variant parameter in testthat::expect_snapshot_file() to create OS-specific snapshots when file formats produce different output across platforms.

Common use cases:

  • RDS files: Binary serialization format that can differ across OS

  • Platform-specific numeric computations (e.g., MCMC algorithms)

  • Files with platform-specific line endings or encodings

Value

A character string: "linux", "darwin" (macOS), or "windows"

Examples

Code
[1] "linux"