R Environment Setup
The development environment for R language inherently includes a graphical development environment, which is different from many other engineering languages. Therefore, it is best to install the development environment on an operating system designed for desktop personal computers (such as Windows, macOS, or Ubuntu Desktop Edition, etc.).
First, we need to download the installation package for the R language environment:
Windows
Official address: https://cloud.r-project.org/bin/windows/base/
USTC Mirror: https://mirrors.ustc.edu.cn/CRAN/bin/windows/base/
TUNA Mirror: https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/base/
Linux
Official address: https://cloud.r-project.org/bin/linux/
USTC Mirror: https://mirrors.ustc.edu.cn/CRAN/bin/linux/
TUNA Mirror: https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/linux/
macOS
Official address: https://cloud.r-project.org/bin/macosx/
USTC Mirror: https://mirrors.ustc.edu.cn/CRAN/bin/macosx/
TUNA Mirror: https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/macosx/
The versions above may be outdated. If you need the latest version, you can visit:
Tsinghua University Mirror: https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/
Official Website: https://cloud.r-project.org/bin/
Windows Operating System
The installation on Windows is straightforward. After downloading the installation package, double-click the downloaded package to start the installation wizard:
Note: The operating system used here is 64-bit, but there are still a few computers using 32-bit operating systems. If your operating system is 32-bit, please select the "32-bit User Installation" option in this step.
When we enter the following code in the interactive command window:
print("Hello, world")
The output will be:
"Hello, world"
Linux
Ubuntu Installation
Execute the following commands to install the R language execution environment:
# sudo apt update
# sudo apt -y upgrade
# sudo apt -y install r-base
After successful installation, executing the R
command will bring you to the interactive programming window:
CentOS Installation
# sudo yum install R
Enter the following command to check the installed version:
# R --version
The interactive command can be exited by typing q()
:
> q()
Save workspace image? [y/n/c]: y
macOS Installation
The installation of the R language environment on macOS is similar to Windows. Download the pkg installation package, double-click to open it, and then follow the installation wizard:
After successful installation, executing the R
command will bring you to the interactive programming window:
The interactive command can be exited by typing q()
:
> q()
Save workspace image? [y/n/c]: y