What is R Programming Language?
R is an open-source programming language that many data analysts, data scientists, statisticians utilize to analyze data and perform statistical analysis using graphs and other forms of visualizations.
Introduction to R Programming
R is a programming language and software environment for Statistical Analysis, Graphics Representation and reporting. R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team. R is freely available under the GNU General Public License, and pre-compiled binary versions are provided for various operating systems like Linux, Windows and Mac. This programming language was named R, based on the first letter of first name of the two R authors (Robert Gentleman and Ross Ihaka). It is one of the most popular languages used by statisticians, data analysts, researchers and marketers to retrieve, clean, analyze, visualize and present data.
R is a programming language is widely used by data scientists and major corporations like Google, Airbnb, Facebook, Twitter, Microsoft, Uber etc. for data analysis. This is a complete course on R for beginners and covers basics to advance topics like machine learning algorithm, linear regression, time series, statistical inference etc.
Features of R Programming
Various benefits of R language are mentioned below, which will help you to grasp the concept:
1. Open Source R is an open-source programming language. This means that anyone can work with R without any need for a license or a fee. Furthermore, you can contribute towards the development of R by customizing its packages, developing new ones and resolving issues.
**2. Exemplary Support for Data Wrangling**** R provides exemplary support for data wrangling. The packages like dplyr, readr are capable of transforming messy data into a structured form.
3. The Array of Packages R has a vast array of packages. With over 10,000 packages in the CRAN repository, the number is constantly growing. These packages appeal to all the areas of industry.
4. Quality Plotting and Graphing R facilitates quality plotting and graphing. The popular libraries like ggplot2 and plotly advocate for aesthetic and visually appealing graphs that set R apart from other programming languages.
5. Platform Independent R is a platform-independent language. It is a cross-platform programming language, meaning that it can be run quite easily on Windows, Linux, and Mac.
6. Machine Learning Operations R provides various facilities for carrying out machine learning operations like classification, regression and also provides features for developing artificial neural networks.
7. Statistics R is prominently known as the lingua franca of statistics. This is the main reason as to why R is dominant among other programming languages for developing statistical tools.
8. Continuously Growing R is a constantly evolving programming language. It is a state of the art that provides updates whenever any new feature is added.
1. Weak Origin R shares its origin with a much older programming language “S”. This means that it does not have support for dynamic or 3D graphics.
2. Data Handling In R, the physical memory stores the objects. This is in contrast with other languages like Python. Furthermore, R utilizes more memory as compared with Python. Also, R requires the entire data in one single place, that is, in the memory. Therefore, it is not an ideal option when dealing with Big Data.
3. Basic Security R lacks basic security. This feature is an essential part of most programming languages like Python. Because of this, there are several restrictions with R as it cannot be embedded into a web-application.
4. Complicated Language R is not an easy language to learn. It has a steep learning curve. Due to this, people who do not have prior programming experience may find it difficult to learn R.
5. Lesser Speed R packages and the R programming language is much slower than other languages like MATLAB and Python.
The algorithms in R are spread across different packages. Programmers without prior knowledge of packages may find it difficult to implement algorithms.
R applications are not enough until you don’t know how people/companies are using the R programming language.
print("Hello World")
[1] "Hello World"
# This is an example of Single Line Comment
3.15 is a decimal value called numerics. 4 is a natural value called integers. Integers are also numerics. TRUE or FALSE is a Boolean value called logical. The value inside ” ” or ‘ ‘ are text (string). They are called characters.
<-
name_of_variable <- value
=
name_of_variable = value
# Numeric
x <- 28
print(x)
class(x)
[1] 28
# Numeric
x = 28
print(x)
class(x)
[1] 28
# String
y <- "Itronix Solutions"
print(y)
class(y)
[1] "Itronix Solutions"
# Boolean
z <- TRUE
print(z)
class(z)
[1] TRUE
# Complex
v <- 2+5i
print(v)
print(class(v))
[1] 2+5i [1] "complex"
# Raw
v <- charToRaw("Hello")
print(v)
print(class(v))
[1] 48 65 6c 6c 6f [1] "raw"
print(ls())
[1] "a" "v" "x" "y" "z"
a="hello"
print(a)
rm(a)
print(a)
[1] "hello"
Error in print(a): object 'a' not found Traceback: 1. print(a)
# We can use the print() function
print("Hello World!")
# Quotes can be suppressed in the output
print("Hello World!", quote = FALSE)
# If there are more than 1 item, we can concatenate using paste()
print(paste("How","are","you?"))
[1] "Hello World!" [1] Hello World! [1] "How are you?"
typeof(5)
typeof(45.L)
typeof('Itronix')
typeof(TRUE)
typeof(3+2i)
a=readline()
print(a)
hello [1] "hello"
a=readline(prompt="Enter name: ")
print(a)
print(class(a))
typeof(a)
Enter name: Itronix Solutions [1] "Itronix Solutions" [1] "character"
a=readline(prompt="Enter Integer: ")
b=readline(prompt="Enter Float: ")
c=readline(prompt="Enter String: ")
typeof(a)
typeof(b)
typeof(c)
Enter Integer: 34 Enter Float: 3.643 Enter String: Itronix Solutions
a=readline(prompt="Enter Integer: ")
a=as.integer(a)
print(a)
typeof(a)
Enter Integer: 34 [1] 34
a=as.integer(readline(prompt="Enter Integer: "))
print(a)
typeof(a)
Enter Integer: 12121 [1] 12121
11 List R Tutorials by : Er Karan Arora : Founder & CEO – ITRONIX …