Server Side Programming Articles

Page 1917 of 2109

Create a date column in R using a date vector excluding weekends.

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

If we have a vector of dates that contains all days in a week then we can use that vector to create a date column by excluding weekends with the help of subsetting the vector as shown in the below Examples. After subsetting the vector, we will just need to pass the vector in data.frame function.Example 1Consider the below vector of dates −x

Read More

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 292 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 324 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
Showing 19161–19170 of 21,090 articles
Advertisements