Nizamuddin Siddiqui has Published 2307 Articles

How to add title at the top of multi-plots created by using gridExtra in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 12:10:08

8K+ Views

The gridExtra package works as an alternative of par(mfrow) with ggplot2, therefore, we can create multiple plots using ggplot2 and gridExtra on a single plot window. Now, if we want to give a title to all of the plots or we can say if want to give a main title ... Read More

How to get the US states name abbreviation in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 12:07:43

488 Views

There are fifty states in United States, few of them have short names but most of the states have a lengthy name. Therefore, if we are dealing with data that has states name of United States then it will be a little complicated to access the states by using their ... Read More

What are the restrictions on creating a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 12:04:54

176 Views

There are four main restrictions on creating a vector in R. We must remember these restrictions while creating any type of vector −A vector name cannot have % sign.A vector name cannot start with a number.A vector can start with a dot but it should not have a number after ... Read More

How to find the correlation matrix by considering only numerical columns in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 12:03:54

840 Views

While we calculate correlation matrix for a data frame, all the columns must be numerical, if that is not the case then we get an error Error in cor(“data_frame_name”) : 'x' must be numeric. To solve this problem, either we can find the correlations among variables one by one or ... Read More

How to change the title size of a graph using ggplot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 12:01:46

2K+ Views

The size of a graph title mattes a lot for the visibility because it is the first thing people look at after plot area. Its size must not be very large nor very small but is should be different from the axis titles and axes labels so that there exists ... Read More

How to combine the levels of a factor variable in an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 11:58:43

4K+ Views

An R data frame can have numeric as well as factor variables. It has been seen that, factor levels in the raw data are recorded as synonyms even in different language versions but it is rare. For example, a factor variable can have hot and cold as levels but it ... Read More

How to find the difference in number of days between two date columns of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 11:56:29

1K+ Views

When dealing with date data, we often want to find the difference between dates if the data contains two or more date values. Same thing can be done for the two columns of an R data frame that contains dates but first we need to read those date columns in ... Read More

How to find the position of a non-NA value in an R vector?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 11:54:06

582 Views

An NA value in R represents not available or missing value, therefore, it is not useful for any type of mathematical operations. Hence, non-NA values are the values that matters and we might want to find the position of these values. We can find the position of non-NA values in ... Read More

How to transform numbers between 1 and 12 to abbreviated month in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 11:52:56

350 Views

Sometimes date vector for months is recorded in numeric form and it becomes difficult to treat or visualize it as a date vector. For example, if a vector for months has numbers 1 that represents January, 2 that represents February and so on then it is considered as a numeric ... Read More

How to remove some last elements of a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 24-Aug-2020 11:51:02

5K+ Views

A vector in R can have infinite number of elements but we might want to remove some of them. To remove the last elements of a vector, we can use head function with negative sign of the number of values we do not want. For example, if we have a ... Read More

Advertisements