1

all I am trying to add scaled raw soil data element based on IQR, could you please help, how I can add this new scaled variable to original dataset, could you confirm the below if it is correct?

 > ph1 <- read.table("clean.raw.elements.txt", header=T, sep="\t")
    > head(ph1)
        ID  X.x Score.x Match_type.x    Mo
    1   N10  132   94.23            A     0.96500  
    2   N12 1014   94.34            A     0.45000
    3   N13 1029   95.41            A     0.42750 
    4   N14 1030   94.72            A     0.67333
    5   N16 1599   94.29            A     0.46500
    6   N17 1602   93.85            A     0.32500
&gt; data &lt;- ph1[,5]
&gt; head(data)
[1] 0.96500 0.45000 0.42750 0.67333 0.46500 0.32500
&gt; length(data)
[1] 1765
&gt; quartiles &lt;- quantile(data, probs=c(.25, .75), na.rm = FALSE)
&gt; IQR &lt;- IQR(data)

> ph1$MoScaled <- ph1$Mo/IQR

bioinfonext
  • 111
  • 2

0 Answers0