I have the my_data_frame
data frame in R language:
s1 = c("a1", "b1", "a2", 'c5', 'b2', 'u8')
b2 = c(3, 6, 1, 5, 2, 1)
d3 = c(T, F, F, T, F, T)
my_data_frame = data.frame(s1, b2, d3)
print (my_data_frame)
There is the following result:
s1 b2 d3
1 a1 3 TRUE
2 b1 6 FALSE
3 a2 1 FALSE
4 c5 5 TRUE
5 b2 2 FALSE
6 u8 1 TRUE
What's the best way of getting rows with minimum value from column b2
of this data frame?
After the execution the result must be the following:
s1 b2 d3
3 a2 1 FALSE
6 u8 1 TRUE
Have you tried this?
my_data_frame[my_data_frame$b2 == min(my_data_frame$b2),]
# s1 b2 d3
#3 a2 1 FALSE
#6 u8 1 TRUE