Hi list, I need to subset the dataframe below by selecting rows with maximum
LRVS_cpue values for each outing_ID. For example, where outing_ID == 51801,
the new dataframe should have only one row with LRVS_cpue = 0.5. LRVS_cpue
in all other rows should remain as 0. I have over 650 000 rows, so looping
is very slow.

 

I have tried: >cpueData1 <-
data.frame(unique(cpueData[max(cpueData$LRVS_cpue),])) but this does not
work.

 

Any help would be greatly appreciated.

 

 


patrol_ID

outing_ID

num_anglers

hours_fish

ang_hours

LRVS_cpue


51709

51795

2

3.5

7

0


51709

51796

1

0.5

0.5

0


51709

51797

1

1

1

0


51709

51798

1

2

2

0


51709

51799

5

5.5

27.5

0


51709

51800

1

3

3

0


51709

51801

2

1

2

0


51709

51801

2

1

2

0.5


51709

51802

1

1.5

1.5

0


51709

51803

3

1

3

0


51709

51804

4

1

4

0

 

JADE MAGGS

Assistant Scientist


	[[alternative HTML version deleted]]

