Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

r first row by group

df <- data.frame(group=c("a", "b"), value=1:8)
## Order the data frame with the variable of interest
df <- df[order(df$value),]
## Aggregate
aggregate(df, list(df$group), FUN=head, 1)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #row #group
ADD COMMENT
Topic
Name
7+1 =