
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

137 Views
To create a column of difference in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of difference in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

1K+ Views
To combine two rows in data.table object in R by addition, we can follow the below steps −First of all, create a data.table object.Then, using plus sign (+) to add two rows and store the addition in one of the rows.After that, remove the row that is not required by subsetting with single square brackets.ExampleCreate the data.table objectLet’s create a data.table object as shown below: −library(data.table) x

141 Views
To create a column of total in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of total in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

5K+ Views
To find the mean of multiple columns based on multiple grouping columns in R data frame, we can use summarise_at function with mean function.For Example, if we have a data frame called df that contains two grouping columns say G1 and G2 and two numerical columns say Num1 and Num2 then we can find the mean of Num1 and Num2 based on G1 and G2 by using the below mentioned command −df%%group_by(G1,G2)%%summarise_at(vars("Num1","Num2"),mean)Example 1Following snippet creates a sample data frame −Gender

191 Views
To find the groupwise mean and groupwise sum at the same time, we can first convert the data frame into a data.table object and then apply the sum function and mean function for data.table object groups as shown in the below examples.Example 1Following snippet creates a sample data frame −Group

177 Views
When we want to find the combinations of a vector elements, we can use combn function with size of the combination say 2 for pairs but the result gives space between the values. If we do not want to get the combinations with space then combn function will be used with paste function by collapsing the space as shown in the below examples.Check out the below examples to understand how it can be done.Example 1To find all combinations of a vector elements without space, use the snippet given below −x1

537 Views
To minus every element of a vector with every element of another vector, we can use outer function by defining the subtraction sign.For example, if we have two vectors say x and y and we want to minus every element in x from every element in y then we can use the below mentioned command −outer(x,y,`-`)Example 1Following snippet creates a sample vector −x1

2K+ Views
To change the name of data frames stored in an R list, we can follow the below steps −First of all, create a list of data frames.Then, use names function to change the name of data frames.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

1K+ Views
To find the frequency of particular value in rows of an R data frame, we can use mutate function of dplyr package along with rowSums function.For example, if we have a data frame called df then we can find the number of 5’s in each row of df by using the below command −df%>%mutate(Number_of_Fives=rowSums(.==1))Example 1Following snippet creates a sample data frame −x1