Nizamuddin Siddiqui has Published 2307 Articles

How to create a bar plot using ggplot2 with one bar having black border in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:28:24

692 Views

The bar plot can be easily created with the help of geom_bar. But if we want to have a different border for a particular bar then we first need to create the bar plot and store it in an object. After that we need to add the original plot with ... Read More

How to reduce a matrix in R to echelon form?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:26:17

1K+ Views

The echelon form of a matrix is the matrix that has the following characteristics:1. The first non-zero element in each row, called the leading entry, is 1.2. Each leading entry is in a column to the right of the leading entry in the previous row.3. Rows with all zero elements, ... Read More

How to remove rows based on blanks in a column from a data frame in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:24:09

4K+ Views

Sometimes data is incorrectly entered into systems and that is the reason we must be careful while doing data cleaning before proceeding to analysis. A data collector or the sampled unit might enter blank to an answer if he or she does not find an appropriate option for the question. ... Read More

How to replace values in a vector with values in the same vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:22:29

879 Views

The replacement of values in a vector with the values in the same vector can be done with the help of replace function. The replace function will use the index of the value that needs to be replaced and the index of the value that needs to be placed but ... Read More

How to standardized a column in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:20:54

359 Views

The standardization means converting a vector or column of an R data frame in a way such that the mean of the same becomes 0 and the standard deviation becomes 1, that is it should be converted to standard normal distribution. In R, it can be easily done with the ... Read More

How to create a plot using rgb colors in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:18:50

510 Views

The rgb colors are referred to red green and blue. This combination helps us to create many different colors. In R, we can use rgb function to create a plot using with different colors along with the image function. If we want to have a plot with rgb colors without ... Read More

How to create a random vector in R that sums to 1?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:16:44

445 Views

To create a random vector that sums to 1, we can use uniform distribution. The main thing that needs to be done cautiously is we should include 0 in the vector with randomly generating uniform distribution values. Check out the below examples to understand how it can be done.Example1Live Demo> ... Read More

How to create a plot in base R with mixed font of plot title such as default and italics?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:14:51

138 Views

We sometimes want to highlight the main title of a plot and one of the ways to do it is changing the font of the title to a unique or using a mixed font for the title. If we want to used mixed font then we need to use the ... Read More

How to find the range of a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:13:08

3K+ Views

The range function in R provides the minimum and maximum values instead of the difference between the two. Hence, we can find the minimum and maximum by using range function then diff function can be used to find the actual range. For example, if we have a vector x then ... Read More

How to find the minimum and maximum of columns values in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:10:14

106 Views

The range function in R provides the minimum and maximum values instead of the difference between the two. Hence, we can find the minimum and maximum by using range function but for a data frame we cannot use it directly. Check out the below examples to understand how it works.Example1Live ... Read More

Advertisements