R.P. Tamil Selvan R.P. Tamil Selvan - 1 year ago 48
R Question

extracting value of variable from dataframe

I have one issue in selecting a value of one variable conditional on the value of another variable in a dataframe.


Now i want to know the value of Log10Dilutionfactor condition on the value of Protection is equal to either 50 (if it appear) or the value immediately just below 50.
when i used
subset(RM,Protection<= 50)
it gives three rows and when I tried
it gives 0 values with warning message. I really appreciate if someone help me.

Answer Source

You can use 2 subset:

subset(RM,Protection==max(subset(RM,Protection<= 50)$Protection))$Log10Dilutionfactor
# [1] 0.954243
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download