Summarize with a condition

0 votes
My requiremnt is to summarize fields that will pass a condition. How to summarize with if condition?
Aug 6 in Data Analytics by riya
13 views

1 answer to this question.

0 votes

You can provide condition to summarize using summarize_if() function.

Syntax of summarizze_if function is as below.

summarize_if(condition, function)

ex: 

summarise_if(is.numeric, sum, na.rm=TRUE)
answered Aug 7 by anonymous
• 28,280 points

Related Questions In Data Analytics

+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE) ...READ MORE

answered Aug 14 in Data Analytics by anonymous
85 views
0 votes
1 answer

With the help of tidyverse: how to rename a column to a variable name

With the help of Dplyr: rename function ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Apr 3, 2018 by DeepCoder786 44 views
+1 vote
1 answer

How to convert a list of vectors with various length into a Data.Frame?

We can easily use this command as.data.frame(lapply(d1, "length< ...READ MORE

answered Apr 4, 2018 in Data Analytics by DeepCoder786
• 1,720 points
107 views
0 votes
1 answer

Selecting a sublist with purrr

Yes, purrr does provide a package called ...READ MORE

answered Apr 4, 2018 in Data Analytics by Bharani
• 4,550 points
39 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
105 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
136 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points
78 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
86 views
0 votes
1 answer

How to filter only those rows with a condition in R?

Write R code as below temp = data ...READ MORE

answered Jul 15 in Data Analytics by anonymous
• 28,280 points
29 views
0 votes
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 28,280 points
118 views