Nizamuddin Siddiqui has Published 2307 Articles

How to find the mean of very small numbers in numeric form that are represented with scientific notation in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:07:55

102 Views

If we find the mean of scientific numbers then the result will be also in scientific notation. We can get rid of this problem by using options(scipen=999), once we will use this code in R console all the inputs that are in scientific notation will be converted to normal numeric ... Read More

How to find the absolute distance between columns of an R data frame?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:04:02

594 Views

The absolute distance can be found by calculating the difference between column values. And if we want the distance to be absolute then we would be need to use abs function. For example, suppose we have a data frame df that contain columns x and y then the absolute distance ... Read More

How to create bitmap display in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 10:00:27

302 Views

The X Window System is a windowing system for bitmap displays. In R, we can create this graphical display by simply typing x11 in the R console and the graphic interface will pop-up on the right-hand side. We can change the width and height of this display by using the ... Read More

How to create a boxplot in base R without any axes except Y?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:58:12

121 Views

The boxplot function in base R helps us to create the boxplot without any hustle but this plot is covered with a square bracket and also takes the Y-axis labels on left-hand side. We can get rid of this square bracket without making an impact on the Y-axis labels. For ... Read More

How to create an only interaction regression model in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:56:23

716 Views

Mostly, we start with creating models by including single independent variables effect on the dependent variable and then move on to interaction. But if we are sure that there exists some interaction among variables and we are looking for the interaction effect then only interaction regression model can be created. ... Read More

How to split a data frame in R with conditional row values?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:54:01

3K+ Views

The splitting of data frame is mainly done to compare different parts of that data frame but this splitting is based on some condition and this condition can be row values as well. For example, if we have a data frame df where a column represents categorical data then the ... Read More

How to display long X-axis labels in a bar chart using plotly in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:50:16

334 Views

Plotly in R is a package specifically designed to create highly-interactive and publication-quality charts. The chart can be created by using plot_ly function of the package and there are three main arguments of plot_ly defined as x, y, and type, where x refers to the X-axis, y refers to the ... Read More

How to extract columns of a data frame with their names after converting it to a time series object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:47:56

353 Views

To access columns of data frame in R, we just need to use $ sign but if the data frame is converted to a time series object then all the columns will behave as a time series, hence, we cannot simply use $ sign. For this purpose, we would need ... Read More

How to create a function in R with two inputs?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:42:36

4K+ Views

To create a function with two inputs, we just need to provide two different arguments inside function. For example, if we want to create a function to find the square of a+b then we can use x and y inside function. Check out the below examples to understand how we ... Read More

How to extract variables of an S4 object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 23-Nov-2020 09:38:45

2K+ Views

Suppose we want to create an S4 with defined name data and two numerical columns called by x and y then we can use setClass("data", representation(x1="numeric", x2="numeric")). Now, if we want to extract the variables of this S4 object then we would need to use @ sign instead of $ ... Read More

Advertisements