R as a programming language was developed by Ross Ihaka and Robert Gentleman in 1993. It is a language and environment for statistical computing and graphics.
1. First, download the newest version of R and save it on your computer, and then install it in your windows using default settings.
- Visit: https://cran.r-project.org/
- Select Download R for Windows, Linux, macOS depending on your device OS.
- Click on install R for the first time in the base sub-directories.
- There you get the link to Download R. (Or, directly to the link: https://cran.r-project.org/bin/windows/base/R-4.1.0-win.exe for Windows users)
2. Now you need RStudio, which is an application that helps you write in R . So, for this again do a search for the latest version and install it on your computer using default settings.
- Visit rstudio.com and go to DOWNLOAD in the navbar or directly visit the link: https://www.rstudio.com/products/rstudio/download/
- Select the free version RStudio Desktop.
- Select the OS of your device on which you are going to install. The recommendation would show if not select one.
- You would get the RStudio-version.exe file downloaded. (Ex. RStudio-1.4.1717.exe in Windows)
- Run the file to install. Click 'Yes' when it asks for permission to install and follow the steps accordingly and wait until you get your device installed with RStudio.
3. Once you download both of the applications, you can then begin using R by opening the Rstudio program.
R packages
Before working on R in R studio, you must install the R packages. The easiest way to install an R package is to use the command.
install.packages ("<package_name>")
R- Data Types
In R, variables are assigned with R-objects and the data type of the R-object is the data type of the variables. The frequently used R-objects are Vectors, Lists, Matrices, Arrays, Factors, and Data frames.
1.Vector
The simplest object is the vector object and there are six data types of these atomic vectors. In creating a vector with more than one element, you should c() function which means to combine the elements into a vector.
2. Lists
3. Matrix
A matrix is a two-dimensional rectangular dataset. It can be created using a vector input to the matrix function.
4. Factors
Factors are r-objects that are created using a vector. It stores the vectors with the distinct values of the elements in the vector as labels.
5. Data frames
R Operators
- Arithmetic operators
- Relational operators
- Logical operators
- Assignment Operators
- Miscellaneous operators
0 Comments