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

Conditional Summing in R (ddply, summarize, sum)

I have a data frame with observations of 6 different variables and a sample weight for each one. I am trying to use ddply with summarize to create a new data frame, in which one of the six variables becomes the first column and the others are the…
0
votes
2 answers

Cannot get sum per group in data tbl when using dplyr in R

I'm using dplyr to try to get means of 6 variables according to 3 groups, and I want to have the count of each cell as well(i.e., I want to add a column of counts for each group-variable pair) my code is something like this: bitul_reason_tbl <-…
Corel
  • 581
  • 3
  • 21
0
votes
1 answer

Summarize means of data frames in a list

I have some data frames in a list with all having the same structure – in this example the variables a, b and c. Now I want to summarize the means of the values across the list. # list of 10 random data frames n <- 1e1 initSeed <-…
jay.sf
  • 60,139
  • 8
  • 53
  • 110
0
votes
2 answers

Calculate Median after Summarize with detail in Stata

The summarize command creates various scalars in Stata. For instance, one can store the mean or min/max values through gen mean=r(mean)afterwards. It is also possible to get more sophisticated measures via the summarize varname, detailoption.…
Dima
  • 146
  • 1
  • 1
  • 12
0
votes
1 answer

Breaking NSE function in new dplyr version

When updating to newest version of the package dplyr, a funcion I have using NSE breaks. I was wondering how the new version changes this and how to fix it. I've tried using the .data$ and .env$ before each variable name but can't seem to get it…
eflores89
  • 339
  • 2
  • 10
  • 27
0
votes
2 answers

R - dplyr summary over combinations of factors

If I have a simple data frame with 2 factors (a and b) with 2 levels (1 and 2) and 1 variable (x), how do I get the median values of x: median x over each level of factor a, each level of factor b, and each combination of a*b? library(dplyr) df…
David G
  • 1
  • 1
0
votes
2 answers

R summing up total for each class for each id

Say I have a dataset like this: df <- data.frame(id = c(1, 1, 1, 2, 2), classname = c("Welding", "Welding", "Auto", "HVAC", "Plumbing"), hours = c(3, 2, 4, 1, 2)) I.e., id classname hours 1 1 Welding 3 2 1 Welding …
Jacob Curtis
  • 788
  • 1
  • 8
  • 22
0
votes
0 answers

Summarise and sum returns no values in R

tenancy <- main_tenant%>% group_by(`Tenancy Type`)%>% summarise(num = length(`Tenancy Type`), total = sum(`Number of Works Order`)) I'm trying to get this code to count the amount of different Tenancy…
MLPNPC
  • 454
  • 5
  • 18
0
votes
1 answer

Apply function in summarise using ddply to find percentage of frequencies

I have a table similar to this one: id name gender age count 1 apple Male 13-20 25 1 apple Male 21-40 30 1 apple Female 13-20 60 1 apple Female 21-40 42 2 banana Male …
R Bud
  • 261
  • 1
  • 4
  • 16
0
votes
1 answer

Grafana sumarize sum resolution

Grafana 3.1.1 with a whisper backend. I am trying to use summarize to keep track of how many minutes during the day one if my parameters is set to 1. Here is the statement that I am using: summarize(thermostat.living_room.heatstate, '1d', 'sum',…
lmwilco1
  • 1
  • 2
0
votes
1 answer

Crystal Reports XI running totals in a crosstab shown as percentage

I have created a crosstab with 2 separate Running Totals in my summarized fields. I need to show these running totals as a percentage of another summarized field. I need to add (#RTotal0 / Count of Gf.Gf_IDKEY) as a summarized field shown as a…
0
votes
3 answers

Summarize the lowest values in a Dataframe?

My data frame looks like this: View(df) Product Value a 2 b 4 c 3 d 10 e 15 f 5 g 6 h 4 i 50 j 20 k 35 l …
Marre
  • 93
  • 1
  • 8
0
votes
1 answer

Generated integer array based on number in rails

I want to generate 5 buttons with different values based on one integer. For example I've got 30, I want to create buttons with 10 20 30 40 50 value = 30 int1 = value - 20 int2 = value - 10 int3 = value int4 = value + 10 int5 = value +…
Archer
  • 1,062
  • 1
  • 13
  • 32
0
votes
2 answers

Aggregating rmse and r2 in r

Here is a sample data as data2: lvl x y 0 20.099 21.2 100 21.133 21.4 250 20.866 21.6 500 22.679 21.8 750 22.737 22.1 0 30.396 32.0 100 31.373 32.1 250 31.303 32.2 500 33.984 32.8 750 44.563 38.0 0 22.755 18.5 100 23.194 18.8 250 23.263…
G1124E
  • 407
  • 1
  • 10
  • 20
0
votes
1 answer

Syntax to use group_by() within summarize()

How can I use the group_by() function within summarize() as below: summarize(group_by(product),sum(Sales))