Nizamuddin Siddiqui has Published 1958 Articles
Nizamuddin Siddiqui
3K+ Views
There are two easy methods to select columns of an R data frame without missing values, first one results in a vector and other returns a matrix. For example, if we have a data frame called df then the first method can be used as df[, colSums(is.na(df))==0] and the second ... Read More
Nizamuddin Siddiqui
827 Views
To display tick marks on upper as well as right side of the plot, we can create duplicate axes for X as well Y by using scale_x_continuous and scale_y_continuous functions. The argument that will help us in this case is sec.axis and we need to set it to dup_axis as ... Read More
Nizamuddin Siddiqui
691 Views
To calculate the z score for grouped data, we can use ave function and scale function. For example, if we have a data frame called df that contains a grouping coloumn say GROUP and a numerical column say Response then we can use the below command to calculate the z ... Read More
Nizamuddin Siddiqui
2K+ Views
To create horizontal lines for each bar in a bar plot of base R, we can use abline function and pass the same values as in the original barplot with h argument that represents horizontal with different color to make the plot a little better in terms of visualization.Example Live DemoxRead More
Nizamuddin Siddiqui
950 Views
To convert the row values in a matrix to row percentage, we can find the row sums and divide each row value by this sum. For example, if we have a matrix called M then we can convert the row values in M to row percentage by using the commandround((M/rowSums(M))*100, ... Read More
Nizamuddin Siddiqui
3K+ Views
To change the tick size using ggplot2, we can use theme function with argument axis.ticks.length. For example, if we have a data frame called df that contains two columns say x and y then the scatterplot between x and y with larger size of tick marks can be created by ... Read More
Nizamuddin Siddiqui
928 Views
If we have a data frame that contains a character column and a named vector which has the same names as in the character column of the data frame then we can combine this data frame and the vector by using match function be appropriately defining the names and the ... Read More
Nizamuddin Siddiqui
5K+ Views
To convert negative values in a matrix to 0, we can use pmax function. For example, if we have a matrix called M that contains some negative and some positive and zero values then the negative values in M can be converted to 0 by using the command pmax(M, 0).ExampleConsider ... Read More
Nizamuddin Siddiqui
6K+ Views
To minus one column from another in an R matrix, we first need to read the matrix as a data frame using as.data.frame then find minus the columns using minus sign and accessing the column of the data frame. To understand how it can be done look at the steps ... Read More
Nizamuddin Siddiqui
2K+ Views
To sort each row of an R data frame in increasing order, we can use apply function for sorting the columns and then transpose the output. For example, if we have a data frame called df that contains 5 columns then each row of df can be sorted in increasing ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP