R: determine if a script is running in Windows or Linux

Viewed 9174

Is there a simple way to programmatically determine if an R script is being executed in Windows vs. Linux?

4 Answers
if(.Platform$OS.type == "unix") {
} else {

}
.Platform$OS.type

returns

[1] "unix"

or something else.

Related