Skip to content

Instantly share code, notes, and snippets.

@cboettig cboettig/example.R
Last active Dec 2, 2015

Embed
What would you like to do?
dplyr group_by() example
import datascience as ds
values = temp = ds.Table.read_table("https://raw.githubusercontent.com/boettiger-lab/espm-88b/master/modules/fish/data/RAM-Legacy-DB/values.csv")
def collapsed(an_array):
return an_array[-1] < 0.1*max(an_array)
values.select(['assessid', 'ssb']).group('assessid', collapsed)
library("dplyr")
values <- read.csv("https://raw.githubusercontent.com/boettiger-lab/espm-88b/master/modules/fish/data/RAM-Legacy-DB/values.csv")
collapsed <- function(x)
x[length(x)] < 0.1 * max(x, na.rm=TRUE)
values %>% group_by(assessid) %>% summarise(collapsed(ssb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.