Bas function install.packages does not provide an easy way to install previous version. There is no argument to provide version number. You provided the version number as the lib argument here.
In the post I linked, the advice command is
remotes::install_version("Rcmdr", "2.5.0")
from remotes
. This is a wrapper around install.packages to install previous version.