R Line Graphs

Line graph or line chart is a graph that connects a series of points by drawing segments between them. A line graph represents the relationship between 2 variables. These points are ordered in one of their coordinates (usually the x- coordinate) value. The plot() function is R is used to create the line graph. Syntax: …

Read moreR Line Graphs

R Inheritance

One the main concept of object oriented programming is inheritance which allows us to define a new class of existing classes. This means that we can derive new classes from existing base classes and adding new features. Hence, inheritance provides re-usability of code. Inheritance in S3 class Since S3 classes do not have any fixed …

Read moreR Inheritance

R Pie Charts

R programming language provides many numbers of libraries to create charts and graphs. A pie-chart is a representation of data as slices of a circle with different colors representing counts or proportions. Each slice is labeled and the numbers corresponding to each slice is also represented in the chart. In R, pie() function is used …

Read moreR Pie Charts

R Loops

Loops are used to repeat a certain set of actions so you don’t have to perform them repeatedly. Suppose you want to perform operation 10 times, if you start writing the code for each time, the program’s length increases and it would be difficult for you to understand it later. But you can remove this …

Read moreR Loops

R Switch Statement

It is an alternate way to a nested if…else statement. A switch statement permits an expression to be tested against a list of case values. In short, we can say that a switch statement is used to compare an expression to known values or number of cases. Syntax:

  First of all, it will …

Read moreR Switch Statement

R If Else Statement

If statement It is the most simple decision-making statement. It checks the condition if the condition is true then only it will execute the block of statements written in the ‘if statement’. Syntax:

  First of all, it will check the given expression or test condition, if it is true then all the statements …

Read moreR If Else Statement

R Bar Charts

Bar charts represent data in the form of rectangular bars. In R, we can create bar charts using barplot() function. We can supply a matrix or vector to this function.  R supports both vertical and horizontal bars in the bar chart. Syntax:

  Here, H is a vector or matrix of numeric values used …

Read moreR Bar Charts

R S3 Class

S3 class implements a style of OO (Object Oriented) programming called generic- function OO. This is totally different from most programming languages, like C++, Java, and C# which implement message passing OO. With message passing messages or methods are sent to objects and the object determines which function to call. Typically, this object has an …

Read moreR S3 Class