Hello, Elahe,
you were, of course, supposed to insert my suggested
code-snippet into you code and test it therein ...
Regards -- Gerrit
-
Dr. Gerrit Eichner Mathematical Institute, Room 212
gerrit.eich...@m
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
wrote:
Homework?
Try ma
Hello,
This can be done by getting the min of Value[Value != 0].
In the code that follows I have named the expected output df2 and
assigned the result to df3 and df4.
library(dplyr)
df3 <- df %>%
group_by(Department,Class) %>%
mutate(flag = Value != 0,
MinValue = min(Value[flag]) ) %
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.eich...@math.uni-gie
4 matches
Mail list logo