Nizamuddin Siddiqui has Published 2307 Articles

How to round to the nearest hundred in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 08:02:24

2K+ Views

To round a value in R, we can use round function and if we want to round to the nearest hundred then -2 value should be used for the rounding. For example, if we have a vector say x that contains 25, 78, 32, 38, 79, 91, 82, 20, 56 ... Read More

How to create bin frequency table in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 08:01:36

1K+ Views

The bin frequency table is the table that represent the frequency for a range of values in a particular variable, in R we generally store these variables in a vector or a column of an R data frame. If we want to create a bin frequency table then table function ... Read More

How to create horizontal histogram in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 08:00:00

1K+ Views

Generally, the histogram is a graph that is displayed in vertical form and it helps us to analyze the distribution of a variable, mainly to understand whether the distribution is normal or not. The horizontal histogram can be also created by using coord_flip function of ggplot2 package. Check out the ... Read More

How to rotate text in base R plot?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:58:21

5K+ Views

To write the text in a base R plot, firstly we should create a blank chart by using type="n" if we want to plot only text then the text should be introduced with the help of text function. Now, if we want to rotate the text value then srt argument ... Read More

How to remove ticks in a plot created by using gglot2 in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:56:31

117 Views

In a plot created by using ggplot2, the axes values are generated with tick marks such as representing X-axis labels from 1 to 10 and Y-axis labels from 10 to 1 but we can get rid of this tick marks by using theme function. If we want to create a ... Read More

How to combine two columns of a data.table object in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:54:07

2K+ Views

A data.table object is almost same as a data frame. To combine two columns of a data.table object, we can use paste0 function. For example, if we have a data frame defined as DT that contains two columns named as x and y then we can combine them using the ... Read More

How to create an arrow in base R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:52:30

2K+ Views

To create an arrow R, we can use plot function and arrows function. We just need to understand all the coordinate values that should be passed inside the arrows function. For example, if we have two vectors that contains values from 1 to 10 then the arrow can be created ... Read More

How to check whether a column value is less than or greater than a certain value in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:50:58

2K+ Views

To check whether a column value is less than or greater than a certain value, we can use with function and the output will be a logical vector representing values with TRUE when the condition is satisfied and FALSE when the condition is not satisfied. For example, if we have ... Read More

How to extract a data.table row as a vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:49:18

1K+ Views

A data.table object is similar to a data frame object but there are few things that can be specifically applied to a data.table because data.table package functions was defined for a data.table object only. If we want to extract a data.table row as a vector then we can use as.vector ... Read More

How to create a hierarchical cluster dendrogram in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 07-Nov-2020 07:47:28

336 Views

A dendrogram display the hierarchical relationship between objects and it is created by using hierarchical clustering. In base R, we can use hclust function to create the clusters and the plot function can be used to create the dendrogram. For example, if we want to create the dendrogram for mtcars ... Read More

Advertisements