Skip to content
Prev 387971 / 398502 Next

Group by and duplicate a value/dplyr

Hello Gerit

mutate(MinValue = min(Value[Value != 0]) )? or? mutate(MinValue = sort(unique(Value))[2]) only mutates one value which is 100, it doesnt mutate minimum?Value != 0 per group by element
On Tuesday, May 11, 2021, 01:26:49 PM GMT+2, Gerrit Eichner <gerrit.eichner at math.uni-giessen.de> wrote:
Homework?

Try maybe

mutate(MinValue = min(Value[Value != 0]) )

or

mutate(MinValue = sort(unique(Value))[2])

? Hth? --? Gerrit

---------------------------------------------------------------------
Dr. Gerrit Eichner? ? ? ? ? ? ? ? ? Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de? Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104? ? ? ? ? Arndtstr. 2, 35392 Giessen, Germany
http://www.uni-giessen.de/eichner
---------------------------------------------------------------------

Am 11.05.2021 um 13:11 schrieb Elahe chalabi via R-help:
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.