Oh, I should have probably specified more details.
Plain R is both Rgui and Rterm, I get correct results in both the usual Rgui console and under a Terminal.
But the Operating System is MacOS Monterey version 12.0.1, with:
> R.version
_
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 1.1
year 2021
month 08
day 10
svn rev 80725
language R
version.string R version 4.1.1 (2021-08-10)
nickname Kick Things
The version of RStudio I'm using is: Version 1.4.1717
EDIT: I've just upgraded RStudio to version 2021.09.1 Build 372, still the same issue.