
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

2K+ Views
The factor with duplicate levels represents grouping data but if we want to convert the grouping data into nominal data then duplicate values must be removed or converted into unique values. To make duplicate factor levels unique in an R data frame, we can use make.unique function.Check out the below Examples to understand how it works.Example 1Following snippet creates a sample data frame −Factor

3K+ Views
We sometimes need to perform mathematical operations on all values in the data set. One such operation could be dividing each value by 100.For example, if we have a data frame called df then we can divide each value in df by 100 by using the below command −df[,1:ncol(df)]/100ExampleFollowing snippet creates a sample data frame −x1

182 Views
We are given positive integer variables as ‘num’ and ‘x’. The task is to recursively calculate the num ^ x then add the digits of a resultant number till the single digit isn’t achieved and the resultant single digit will be the output.Let us see various input output scenarios for this −Input − int num = 2345, int x = 3Output − Recursive sum of digit in n^x, where n and x are very large are: 8Explanation − we are given positive integer values as num and x with the values as 2345 and power as 3. Firstly, calculate 2345 ^ 3 i.e. ... Read More

178 Views
To find the groupwise common value for a data.table object, we can use Reduce function with intersect function.For example, if we have a data.table object called DT that contains a numerical column say Num and a categorical column say C where C exists at the first position then the groupwise common value can be found by using the command given below −Reduce(intersect,DT[,.(list(unique(Num))),C]$V1)ExampleConsider the below data.table object −Group

1K+ Views
To create ggplot2 graph with reversed Y-axis and X-axis on top, we can use scale_y_reverse and scale_x_continuous function of ggplot2 package.For Example, if we have a data frame called df that contains two columns say X and Y and we want to create the scatterplot between X and Y with reversed Y-axis and X-axis on top then we can use the below command −ggplot(df,aes(X,Y))+geom_point()+scale_y_reverse()+scale_x_continuous(position="top")ExampleFollowing snippet creates a sample data frame −x

577 Views
We are given an integer variable as N storing the positive integer type value. The task is to recursively print all the numbers less than given value N having digit 1, 3 or the combination of both.Let us see various input output scenarios for this −Input − int num = 40Output − Recursive program to print all numbers less than N which consist of digits 1 or 3 only are: 33 31 13 11 3 1Explanation − we are given a positive integer value as 40 stored in a variable num. Now, we will recursively find out all the numbers containing digits 1, ... Read More

1K+ Views
To display superscript for X-axis title in base R plot, we can use ^ sign inside mtext function before defining the plain text.For example, if we want to display X2 at position 5 on X-axis then it can be done by using the below command −mtext(expression(paste(plain("X")^plain("2"))), side=1, line=2, at=5, cex=1.2)ExampleConsider the following snippet −plot(1:10) OutputIf you execute the above given snippet, it generates the following Output −To display superscript for X-axis title in base R plot, add the following code to the above snippet −Exampleplot(1:10, xlab="")OutputIf you execute all the above given snippets as a single program, it generates the ... Read More

230 Views
We are given an integer array containing odd and even integer values. The task is to rearrange an array in such a manner that arr[i] should be greater than or equals to arr[j] based on the condition that value at index arr[i] should be even and if value at arr[i] is odd then arr[i] should be less than equals to arr[j].Let us see various input output scenarios for this −Input − int arr[] = {5, 9, 10, 12, 32, 35, 67, 89}Output − Array after rearranging elements are: 12 32 10 35 9 67 5 89Explanation − we are given an array with ... Read More

563 Views
To find the frequency of exclusive group combinations in an R data frame, we can use count function of dplyr package along with ungroup function.For Example, if we have a data frame called df that contains four grouping columns say Grp1, Grp2, Grp3, and Grp4 then we can count the unique group combinations in df by using the below command −count(df,Grp1,Grp2,Grp3,Grp4)%%ungroup()Example 1Following snippet creates a sample data frame −Class1

707 Views
To change the order of independent variables in regression Output, we can pass the variables in the sequence we want while creating the regression model.For example, if we want to have three independent variables and we want to display first at the last position then it can be done as follows −lm(DP1~ ind_var_3+ ind_var_2+ind_var_1,data=”data_frame_name”)ExampleFollowing snippet creates a sample dataframe −iv1