Articles on Trending Technologies

Technical articles with clear explanations and examples

How to limit the length of regression line using ggplot2 in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 998 Views

To limit the length of regression line using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the scatterplot using ggplot2 with regression line.After that, create the scatterplot with regression and add xlim function.Create the data frameLet's create a data frame as shown below −x

Read More

How to create horizontal lines with two different colors after a threshold in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 480 Views

To create two horizontal lines with different color after a threshold in R, we can follow the below steps −First of all, create a plot in base R.Then, add a line to the plot using abline function.After that, use segments function to partially change the color of the line.Create the plotUsing plot function to create a plot in base R −plot(1:5, 1:5, xlim=c(0, 5))OutputAdd a line to the plotUsing abline function to add a line to the plot −plot(1:5, 1:5, xlim=c(0, 5)) abline(h=3)OutputPartially color the lineUsing segments function to color the with yellow color starting from 0 to 3 −plot(1:5, ...

Read More

How to create a scatterplot in base R with points depending on categorical column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 248 Views

To create a scatterplot in base R with points depending on categorical column, we can follow the below steps −First of all, create a data frame.Then, use plot function to create the scatterplot with col argument and using categorical column with factor function.Create the data frameLet's create a data frame as shown below −x

Read More

Node.js – util.deprecate() method

Mayank Agarwal
Mayank Agarwal
Updated on 11-Mar-2026 445 Views

The util.deprecate() method wraps fn (that may be a function or class) in such a way that it is marketed as a deprecated method. The util.deprecate() method returns a function that emits a DeprecationWarning. This warning is printed to the stderr when the function is called the first time. The function is called without any warning once the warning is emitted.Syntaxutil.deprecate( fn, msg, [code] )ParametersThe parameters are defined below:fn − The function that needs to be deprecated.msg − This is a warning message which is invoked once the deprecated function is called.code − This is an optional parameter which displays the passed ...

Read More

Node.js – hmac.update() Method

Mayank Agarwal
Mayank Agarwal
Updated on 11-Mar-2026 822 Views

The Hmac class is one of the many utility classes that is used for creating the cryptographic HMAC digests. The Hmac.update() method is used for updating the Hmac content with the data passed. If encoding is not provided and the data is in string format, then the default encoding 'utf8' is enforced.Syntaxhmac.update(data, [encoding])ParametersThe parameters are described below:data − This input parameter takes input for the data with which Hmac will be updated.encoding − This input parameter takes input for the encoding to be considered while updating the Hmac.Example 1Create a file with the name "hmacUpdate.js" and copy the following code snippet. After ...

Read More

Node.js – forEach() Method

Mayank Agarwal
Mayank Agarwal
Updated on 11-Mar-2026 5K+ Views

The forEach() method in Node.js is used for iterating over a set of given array items. One can iterate over all the values of the array one-by-one using the forEach array loop.SyntaxarrayName.forEach(function)Parametersfunction − The function takes input for the method that will be executed.arrayName − Array that will be iterated.Example 1Create a file "forEach.js" and copy the following code snippet. After creating the file, use the command "node forEach.js" to run this code.// forEach() Demo Example // Defining a vehicle array const vehicleArray = ['bike', 'car', 'bus']; // Iterating over the array and printing vehicleArray.forEach(element => {    console.log(element); });OutputC:\homeode>> ...

Read More

How to find the row that has maximum number of duplicates in an R matrix?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 309 Views

To find the row that has maximum number of duplicates in an R matrix, we can follow the below steps −First of all, create a matrix.Then, convert matrix into data.table then use order function with head function to find the row that has maximum number of duplicates.Create the matrixLet’s create a matrix as shown below −M

Read More

How to save column means into a data frame in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 2K+ Views

To save column means into a data frame in R, we can follow the below steps −First of all, create a data frame.Then, find column means using colMeans function and save it in an object.After that, use as.data.frame function to save the columns means into a data frame.Create the data frameLet's create a data frame as shown below −x1

Read More

How to create a boxplot using ggplot2 with aes_string in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 444 Views

To create a boxplot using ggplot2 with aes_string in R, we can follow the below steps −First of all, create a data frame with one string and one numerical column.Then, use aes_string function of ggplot2 package to create the boxplot.Create the data frameLet's create a data frame as shown below −X

Read More

How to subset rows that contains maximum depending on another column in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 957 Views

To subset rows that contains maximum depending on another column in R data frame, we can follow the below steps −First of all, create a data frame with one numerical and one categorical column.Then, use tapply function with max function to find the rows that contains maximum in numerical column based on another column.Example1Create the data frameLet's create a data frame as shown below −x

Read More
Showing 24851–24860 of 61,297 articles
Advertisements