Questions tagged [summarize]

A dplyr instruction ( actually named summarise( ) ) to create a new data frame by grouping data according to given grouping variables. Use this tag along with the dplyr version being used. Mind the spelling in the method name.

summarise() creates a new data frame. It will have one (or more) rows for each combination of grouping variables; if there are no grouping variables, the output will have a single row (or more, as of 1.0.0) summarising all observations in the input. It will contain one column for each grouping variable and one column for each of the summary statistics that you have specified.

836 questions
-2
votes
1 answer

How to perform aggregation and counting in a Dataset using R?

I'm currently working with a Cricket (a sport) dataset where I need to find the accumulated runs scored, balls bowled per year with the years count. Below is an excerpt of the dataset enter image description here I'm trying to aggregate as below,…
Arun Elangovan
  • 237
  • 1
  • 3
  • 16
-2
votes
2 answers

Summarizing dataset with dplyr

I have a dataset (QB2016) that I want to write r code that will summarize in one dataframe the number of times a player is listed as an observation but also list the "Opp" in the dataframe also. For example from the following: enter image…
-2
votes
1 answer

Applying Functions to several variables, by a number variables

The data I have looks as follows: Week_ID County State date ZCTA T_mean_F Precipitation holiday Units 523 Carroll Iowa 01/01/2010 51401 5.669194 0 1 0 523 Carroll Iowa 01/01/2010 51430 5.757368 0…
-3
votes
1 answer

Using group_by to summarize the data while looping

For example, here is my df: GP_A <- c(rep("a",3),rep("b",2),rep("c",2)) GP_B <- c(rep("d",2),rep("e",4),rep("f",1)) GENDER <- c(rep("M",4),rep("F",3)) LOC <- c(rep("HK",2),rep("UK",3),rep("JP",2)) SCORE <- c(50,70,80,20,30,80,90) df <-…
xxx
  • 53
  • 1
  • 6
-3
votes
1 answer

How to average all columns in dataset by group

I'm using aggregate in R to try and summarize my dataset. I currently have 3-5 observation per ID and I need to average these so that I have 1 value (the mean) per ID. Some columns are returning all "NA" when I use aggregate. So far, I've created a…
Cae.rich
  • 171
  • 7
-4
votes
1 answer

What is wrong with my "summarize" command?

Hello, I am doing a project in which I need to: -define a "Textbook" class in your python script. -create a list of Textbook class for 5 textbooks you possess. -produce a summary of all five Textbooks as shown at the end. I believe that I have all…
Jakspigot
  • 3
  • 3
-5
votes
1 answer

summarizing multiple variables in group by

I need to find the mean of a variable and the number of times a particular combination occurs for that mean value in r. In the example I have grouped by variables cli, cus and ron and need to summarize to find the mean of age and frequency of cash…
Murali
  • 1
  • 1
-6
votes
1 answer

Summarizing a python list of dicts

Given the following python list of dictionaries: product_issues = [ {'product':'battery', 'High': 0, 'Med':1 'Low':0 '}, {'product':'battery', 'High': 1, 'Med':0 'Low':0 '}, {'product':'battery', 'High': 1, 'Med':0 'Low':0 …
-7
votes
2 answers

How can I summarize this Python code in one line?

I have Python code in multiple lines. I want to summarize in one line without ';' and 'exec function' input_string = str(input()) array = [] for i in range(len(input_string)): if (ord(input_string[i]) - 97) % 2 == 0: …
1 2 3
55
56