How to interpret dplyr message `summarise()` regrouping output by ‘x’ (override with `.groups` argument)?

I started getting a new message (see post title) when running group_by and summarise() after updating to dplyr development version 0.8.99.9003. Here is an example to recreate the output: library(tidyverse) library(hablar) df <- read_csv(“year, week, rat_house_females, rat_house_males, mouse_wild_females, mouse_wild_males 2018,10,1,1,1,1 2018,10,1,1,1,1 2018,11,2,2,2,2 2018,11,2,2,2,2 2019,10,3,3,3,3 2019,10,3,3,3,3 2019,11,4,4,4,4 2019,11,4,4,4,4”) %>% convert(chr(year,week)) %>% mutate(total_rodents = rowSums(select_if(., is.numeric))) %>% … Read more

Workflow for statistical analysis and report writing

Does anyone have any wisdom on workflows for data analysis related to custom report writing? The use-case is basically this: Client commissions a report that uses data analysis, e.g. a population estimate and related maps for a water district. The analyst downloads some data, munges the data and saves the result (e.g. adding a column … Read more

Repeat each row of data.frame the number of times specified in a column

df <- data.frame(var1 = c(‘a’, ‘b’, ‘c’), var2 = c(‘d’, ‘e’, ‘f’), freq = 1:3) What is the simplest way to expand each row the first two columns of the data.frame above, so that each row is repeated the number of times specified in the column ‘freq’? In other words, go from this: df var1 … Read more

Append value to empty vector in R?

I’m trying to learn R and I can’t figure out how to append to a list. If this were Python I would . . . #Python vector = [] values = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’] for i in range(0,len(values)): vector.append(values[i]) How do you do this in R? #R Programming > vector = c() > values = c(‘a’,’b’,’c’,’d’,’e’,’f’,’g’) > … Read more

Compare two data.frames to find the rows in data.frame 1 that are not present in data.frame 2

I have the following 2 data.frames: a1 <- data.frame(a = 1:5, b=letters[1:5]) a2 <- data.frame(a = 1:3, b=letters[1:3]) I want to find the row a1 has that a2 doesn’t. Is there a built in function for this type of operation? (p.s: I did write a solution for it, I am simply curious if someone already … Read more