Programming Articles

Page 2186 of 2547

How to change the border line type in base R boxplot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 28-Oct-2021 874 Views

The default boxplot in R has straight border line type that display end point(s) excluding outliers. To change these border lines from a boxplot, we can use staplelty argument.For Example, if we have a vector called X then we can create the boxplot of X with different border line type by using the command boxplot(X,staplelty=15). The argument can take different values. Check out the below Examples to understand how it works.ExampleConsider the below vector −x

Read More

How to change the whisker line type in base R boxplot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 28-Oct-2021 2K+ Views

The default boxplot in R has dotted whisker lines and if we want to change it to something else, we can use the whisklty argument.For Example, if we have a vector called X then we can create the boxplot of X with different whisker line by using the command boxplot(X,whisklty=1). The argument can take different values.Check out the Examples given below to understand how it works.ExampleConsider the vector given below −x

Read More

Create a number vector in R with initial values as zero by defining the maximum digits for each value.

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 27-Oct-2021 125 Views

To create a number vector in R with initial values as zero by defining the maximum digits for each value, we can use sprintf function.For Example, if we want to create a number vector having values starting from 1 to 100 and we want to have 1 as 001 and so on then, we can use the below command −sprintf('%0.3d',1:100)ExampleFollowing snippet creates a sample data frame −x1

Read More

How to remove end lines from a boxplot in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 27-Oct-2021 819 Views

The default boxplot in R has straight lines that display end point(s) excluding outliers. To remove these end lines from a boxplot, we can use staplelty argument and set it to 0.For Example, if we have a vector called X then we can create the boxplot of X by using the command given below −boxplot(X,staplelty=0)ExampleFollowing snippet creates a sample data frame −x

Read More

How to check if a data frame has any missing value in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 27-Oct-2021 2K+ Views

To check if a data frame has any missing value in R, we can use any function along with is.na function. For Example, if we have a data frame called df then we can use the below command to check whether df contains any missing value or notany(is.na(df))Example 1Following snippet creates a sample data frame −x1

Read More

How to create pie chart in base R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 27-Oct-2021 291 Views

A pie chart is a circular representation of data which is created for either nominal data or ordinal data. The slices in the pie chart depend on the magnitude of the data values. If we want to create a pie chart in base R then pie function can be used.For Example, if we have a vector called X then the pie chart for values in X can be created by using the below command −pie(X)ExampleFollowing snippet creates a sample data frame −x

Read More

Create a sample of data frame column by excluding NAs in R

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 27-Oct-2021 323 Views

To create a random sample by excluding missing values of a data frame column, we can use sample function and the negation of is.na with the column of the data frame.For Example, if we have a data frame called df that contains a column X which has some NAs then we can create a random sample of size 100 of X values by using the following command −sample(df$X[!is.na(df$X)],100,replace=TRUE).Example 1Following is the code snippet to create dataframe −x

Read More

Node.js – Timers Module – Scheduling Timers

Mayank Agarwal
Mayank Agarwal
Updated on 27-Oct-2021 796 Views

The timers module contains functions that can execute code after a certain period of time. You do not need to import the timer module explicitly, as it is already globally available across the emulated browser JavaScript API.Timers module is mainly categorised into two categoriesScheduling Timers − This timer schedules the task to take place after a certain instant of time.setImmediate()setInterval()setTimeout()Cancelling Timers − This type of timers cancels the scheduled tasks which is set to take place.   ClearImmediate()clearInterval()clearTimeout()Scheduling Timers1. setTimeout() MethodThe setTimeout() method schedules the code execution after a designated number of milliseconds. Only after the timeout has occurred, the code ...

Read More

Multiples of 3 and 5 without using % operator in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 27-Oct-2021 760 Views

We can find the multiples using % operator without any hurdles. But, the problem states that we can't use % operator.Here, we make use of the + operator. We can get the multiples by adding 3 or 5 to the previous multiple. Let's see an example.Input15Output1 2 3 - Multiple of 3 4 5 - Multiple of 5 6 - Multiple of 3 7 8 9 - Multiple 3 10 - Multiple of 5 11 12 - Multiple of 3 13 14 15 - Multiple of both 3 and 5AlgorithmInitialise the number n.Initialise two number to keep track of next ...

Read More

Number of pairs with Bitwise OR as Odd number in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 26-Oct-2021 309 Views

Given an array, we have to find the number of pairs whose Bitwise OR is an odd number. Let's see the example.Inputarr = [1, 2]Output1 There is only one pair whose Bitwise OR is an odd number. And the pair is (1, 2).AlgorithmInitialise the array with random numbers.Initialise the count to 0.Write two loops to get the pairs of the array.Compute the bitwise OR between every pair.Increment the count if the result is an odd number.Return the count.ImplementationFollowing is the implementation of the above algorithm in C++#include using namespace std; int getOddPairsCount(int arr[], int n) {    int count ...

Read More
Showing 21851–21860 of 25,466 articles
Advertisements