Changing column numbers to 1 in a data.frame if it falls within a range of values

Hi there,

I am trying to do something I thought was fairly simple, but failing.
I want to change the adjusted p-values in this data frame to 1 if they colony size in a different column 'btn1vsade6' is less than +/- 0.1. Below is a summary of the data

skimr::skim(gain)
── Data Summary ────────────────────────
Values
Name gain
Number of rows 3420
Number of columns 5


Column type frequency:
numeric 5


Group variables None

── Variable type: numeric ───────────────────────────────────────────────────
skim_variable n_missing complete_rate mean sd
1 Colony.Size.Difference.1kbvsbtn1 409 0.880 -0.0431 0.200
2 t 820 0.760 -0.202 1.67
3 P.Value 820 0.760 0.363 0.307
4 adj.P.Value 820 0.760 0.551 0.307
5 btn1vsade6 650 0.810 0.00608 0.129
p0 p25 p50 p75 p100 hist
1 -8.67e- 1 -0.152 -0.0321 0.0779 1.39 ▁▇▅▁▁
2 -6.37e+ 0 -1.24 -0.257 0.834 9.03 ▁▇▇▁▁
3 1.84e-11 0.0700 0.298 0.617 1.00 ▇▃▃▃▂
4 4.78e- 8 0.279 0.595 0.823 1.00 ▆▃▆▆▇
5 -1.37e+ 0 -0.0587 0.00602 0.0724 0.647 ▁▁▁▇▁

Kindest regards,

Chris

So I managed to do it on my own in a very round about way

#adjust the pvalues from colony size below -0.1 and above 0.1
gain$adj.P.Value[gain$btn1vsade6 <=-0.1] <-1
gain$adj.P.Value[gain$btn1vsade6 >=0.1] <-1

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.