For windows
To Install R
Open an internet browser and go to www.r-project.org.
Click the "download R" link in the middle of the page under "Getting Started."
Select a CRAN location (a mirror site) and click the corresponding link.
Click on the "Download R for Windows" link at the top of the page.
Click on the "install R for the first time" link at the top of the page.
Click "Download R for Windows" and save the executable file somewhere on your computer. Run the .exe file and follow the installation instructions.
To Install R-Studio
Once R is installed, you need to download and install RStudio.
To Install RStudio
Go to www.rstudio.com and click on the "Download RStudio" button.
Click on "Download RStudio Desktop."
Click on the version recommended for your system, or the latest Windows version, and save the executable file. Run the .exe file and follow the installation instructions.
Courtesy: Edx
Upgrade R to higher version
R is an open source software. The R community and R developers are consistently working to make it more appropriate and powerful to address the evolving requirements of researchers. In this process R keep upgrading its version and releases it over time. An R user also must use the latest version of R at any point in time. A user uses many packages in R other than those which come along with the base. Hence all the packages need to be updated along with R version. The user can run through the following steps to do upgrade R (or replacing computer) seamlessly: -
1. Open R console in RStudio and extract the names of the packages in the existing installation and save it in a file.
# Save the names of the packages in an object
package_names <- installed.pachages()[, "Package"]
#Save the object in a file
save(package_names, file= "packagesInR")
2. Copy “packagesInR” file to the new computer (if switching to a different computer)
3. Install the latest version of R by following the aforesaid steps in. Open R console in the installed latest version and install the packages in “packagesInR” file.
# Load the file in R
load("packagesInR")
#Only those packages to be installed which are not available in the base packages provide in new R installation
for (p in setdiff(package_names, installed.packages()[,"Package"])) {
install.packages(p)
}
You can download my “packagesInR” (as on November 2020) from the following link.
3. Install the latest version of R by following the aforesaid steps in. Open R console in the installed latest version and install the packages in “packagesInR” file.
# Load the file in R
load("packagesInR")
#Only those packages to be installed which are not available in the base packages provide in new R installation
for (p in setdiff(package_names, installed.packages()[,"Package"])) {
install.packages(p)
}
You can download my “packagesInR” (as on November 2020) from the following link.