Edit
I have narrowed down the problem thanks to @MikaelJagan.
When I run the command readLines("/System/Library/CoreServices/SystemVersion.plist")
in the RStudio console, I obtain
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
[2] "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
[3] "<plist version=\"1.0\">"
[4] "<dict>"
[5] "\t<key>ProductBuildVersion</key>"
[6] "\t<string>21C52</string>"
[7] "\t<key>ProductCopyright</key>"
[8] "\t<string>1983-2021 Apple Inc.</string>"
[9] "\t<key>ProductName</key>"
[10] "\t<string>macOS</string>"
[11] "\t<key>ProductUserVisibleVersion</key>"
[12] "\t<string>12.1</string>"
[13] "\t<key>ProductVersion</key>"
[14] "\t<string>12.1</string>"
[15] "\t<key>iOSSupportVersion</key>"
[16] "\t<string>15.2</string>"
[17] "</dict>"
[18] "</plist>"
and when I run it in an R session in the terminal, I obtain
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
[2] "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
[3] "<plist version=\"1.0\">"
[4] "<dict>"
[5] "\t<key>ProductBuildVersion</key>"
[6] "\t<string>21C52</string>"
[7] "\t<key>ProductCopyright</key>"
[8] "\t<string>1983-2021 Apple Inc.</string>"
[9] "\t<key>ProductName</key>"
[10] "\t<string>Mac OS X</string>"
[11] "\t<key>ProductUserVisibleVersion</key>"
[12] "\t<string>10.16</string>"
[13] "\t<key>ProductVersion</key>"
[14] "\t<string>10.16</string>"
[15] "\t<key>iOSSupportVersion</key>"
[16] "\t<string>15.2</string>"
[17] "</dict>"
[18] "</plist>"
I'm not sure why there are different, since I'm providing an absolute path?
Original question
If I open RStudio and type sessionInfo()
into the console, it returns:
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1
However, if I create a R Markdown file, where I include the same command, the knitted HTML file displays
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] digest_0.6.29 R6_2.5.1 jsonlite_1.7.2 magrittr_2.0.1
## [5] evaluate_0.14 rlang_0.4.12 stringi_1.7.6 jquerylib_0.1.4
## [9] bslib_0.3.1 rmarkdown_2.11 tools_4.1.1 stringr_1.4.0
## [13] xfun_0.29 yaml_2.2.1 fastmap_1.1.0 compiler_4.1.1
## [17] htmltools_0.5.2 knitr_1.37 sass_0.4.0
Notably, the operating system in incorrect in the knitted version. I am running Monterey, not Big Sur. Is there an explanation for this?