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
0
votes
1 answer

Summing Up A Certain Column in R

ID Company Price Country City 1 138761 GHI 1320 Netherlands Amsterdam 2 571119 GHI 2060 Netherlands Amsterdam 3 112503 DEF 2310 Germany Berlin 4 885592 DEF 2060 France Paris 5 825832 …
Tony Flager
  • 95
  • 1
  • 8
0
votes
2 answers

How to return the number of unique observations in each group of a data frame

I have a data frame similar to this: data <- data.frame( Location = rep(letters[1:10], each = 20), ID = rep(1:40, each = 5) ) I want to return a table that contains each unique Location in one column and a count of the number of unique IDs in…
Ryan
  • 1,048
  • 7
  • 14
0
votes
0 answers

Direct Query and Summarize workaround

I am having a hard time finding a way to summarize sevaral direct query tables based on some measures. What's really gets me is that, if I create the summarized table (either with SUMMARIZE() or SUMMARIZECOLUMNS()) and then publish it, it actually…
Cosmin
  • 565
  • 1
  • 8
  • 33
0
votes
1 answer

R code to open files one by one perform operations and close open file

I am working on R Studio. I have ~50 txt files, all of which have data in similar format (14 col's in same order). Each file is large (~100MB). I have all the files saved in one folder. What I need to do it write an R code so that I can open one…
0
votes
1 answer

find frequency of events in groups dplyr

I have a grouped df with different lengths of groups. I want to count y/n events within each group. So if I have the following: df <- data.frame(group = rep(1:4,times=c(20,10,17,8)), outcome =…
Jake L
  • 987
  • 9
  • 21
0
votes
0 answers

Summarize: New column using values from different vector

(Rewrite. Very new to R, sorry if my jargon is off below!) Goal: Summarize values in a dataset, create a column with a total of values selected in the summary, then create an average based on that total against the total in the original, summarized…
Rod Gammon
  • 41
  • 1
  • 7
0
votes
0 answers

I want to use a single filter based on multiple columns and summarize the result in Power BI

I have a table where a student can have a characteristic associated in multiple columns, like this: Student Cohort 1 Cohort 2 UnitsEarned A MESA GS 25 B FYE SBP 18 C MESA …
0
votes
0 answers

Function to count number of distinct levels of a factor variable in each group?

I have a dataset with multiple observations from several venues, many of which have multiple observations for them e.g. ID <- paste("s", seq(1,150,1), sep="") venue <- paste("L", sample(c(1:40), size=150, replace =T), sep="") group <- c(rep("A",…
Mel
  • 700
  • 6
  • 31
0
votes
1 answer

R group_by and summarize is not working as it should.. no clue why

This should REALLY work but it doesn't and I lose my mind! This is my data > head(dataset_2,n=5) CUSTOMER_NUMBER OLD_NEW_CLIENT COMPLETION_PRCT CRASH_RISK 1 535961675 Old client 0.06 25 2 223186690 Old…
0
votes
1 answer

RStudio: Organizing the means and medians of groups by factor level

Please forgive me because I'm extremely new to R Studio, so I'd appreciate if you could help via pointing me to documentation or something of the sort. I have a data frame called GSS that has very, very many unlabeled rows and two columns labeled…
0
votes
1 answer

Generating summary table at bottom of dataframe

Please Help!! I have the following dataframe (named Final_APOL1). I need to generate a summary table like the second dataframe shown. Once generated is it possible to save this as a separate output csv that will be saved to the same directory? The…
user12633410
0
votes
1 answer

Use dplyr to summarize but preserve date of group row

I have a data frame like the following: Date Flare Painmed_Use 1 2015-12-01 0 0 2 2015-12-02 0 0 3 2015-12-03 0 0 4 2015-12-04 0 0 5 2015-12-05 0 0 6 …
user1895891
  • 125
  • 1
  • 5
0
votes
1 answer

.drop not working! Including Zero Frequency counts

I'm new to R and the Forum, so let me know if you need any more Information in order to help me with the issue. Big Thanks in advance for any help! I'm currently stuck with a problem, which in theory should be easy to solve with the .drop command,…
user12575032
  • 77
  • 1
  • 6
0
votes
1 answer

ggplot2 with summarize as y aesthetic - r

Here's my task: Create the following graph: Group the Pokemon data by type1 and is_legendary Summarize the data with the mean of the attack Create a bar chart with type1 on the x, the mean of the attack on the y and type one of the fill Change the…
user12554068
  • 31
  • 1
  • 4
0
votes
2 answers

Add summarize variable in multiple statements using dplyr?

In dplyr, group_by has a parameter add, and if it's true, it adds to the group_by. For example: data <- data.frame(a=c('a','b','c'), b=c(1,2,3), c=c(4,5,6)) data <- data %>% group_by(a, add=TRUE) data <- data %>% group_by(b, add=TRUE) data %>%…
dfrankow
  • 20,191
  • 41
  • 152
  • 214