Note that there are some explanatory texts on larger screens.

plurals
  1. POR special data frame
    primarykey
    data
    text
    <p>I'm asking a question follwing the one I asked yesterday in this post : <a href="https://stackoverflow.com/questions/12584704/r-rolling-random-forest-for-variables-selection">Random Forests for Variables selection</a>.</p> <p>I managed to find out for each quarter the most significant technical trading rules. I've built a data frame to put the names of these TTR. Here is it, I've got with one column for quarter.</p> <pre><code> 1 2 3 4 5 6 7 8 9 10 11 1 RSI2 RSI3 RSI2 RSI10 RSI2 RSI2 RSI2 RSI2 RSI2 RSI2 RSI2 2 RSI3 RSI4 RSI3 RSI20 RSI3 RSI3 RSI3 RSI4 RSI4 RSI3 RSI3 3 RSI4 RSI5 RSI4 EMA5 RSI4 RSI4 RSI5 RSI5 RSI5 RSI4 RSI4 4 RSI5 RSI10 RSI5 EMA20 RSI5 RSI5 RSI10 EMA5 RSI10 RSI5 RSI5 5 RSI10 RSI20 RSI10 EMA60 SMA5 RSI10 RSI20 EMA20 RSI20 RSI10 RSI10 6 SMA20 SMA60 RSI20 SMI atr RSI20 SMA60 EMA60 SMA5 RSI20 SMA5 7 SMA60 pctB SMA20 ADX pctB EMA5 atr atr SMA60 atr SMA20 8 atr calcs.1 pctB pctB macd EMA20 pctB ADX pctB ADX EMA20 9 pctB &lt;NA&gt; &lt;NA&gt; macd myVolat EMA60 &lt;NA&gt; pctB macd pctB EMA60 10 myChaikinVol &lt;NA&gt; &lt;NA&gt; signal calcs.1 pctB &lt;NA&gt; macd signal myVolat ADX 11 myVolat &lt;NA&gt; &lt;NA&gt; calcs &lt;NA&gt; macd &lt;NA&gt; signal mySAR calcs.1 pctB 12 calcs &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; myVolat myVolat &lt;NA&gt; myChaikinVol 13 &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; calcs.1 &lt;NA&gt; &lt;NA&gt; myVolat 14 &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; calcs </code></pre> <p>I've added <code>NA</code>to cope with the differing length of rows.</p> <p>Now, I would like to come back to my dataset which looks like that :</p> <pre><code> daily.returns RSI2 RSI3 RSI4 RSI5 RSI10 RSI20 SMA5 SMA20 SMA60 EMA5 EMA20 EMA60 atr SMI ADX oscillator pctB macd signal myChaikinVol mySAR myVolat calcs calcs.1 2009-01-07 -0.015587635 97.964071 92.62210 87.21605 82.40040 66.95642 55.19221 19720.64 18655.29 17758.68 2556.777 2556.777 2556.777 82.06602 27.52145 17.31637 85 0.87092366 0.5930649 -0.220581024 -0.3211637 2369.876 0.2325009 0.3169638 0.2801128 2009-01-08 -0.008700162 43.766573 58.62387 62.97794 64.03382 60.23197 52.99739 19756.44 18666.60 17754.07 2566.499 2566.499 2566.499 80.33416 29.12141 16.86914 85 0.72197937 0.8929854 0.002132269 -0.3183377 2385.210 0.2201065 0.3169831 0.2654092 2009-01-09 -0.011980596 27.182247 44.97072 52.29336 55.50633 56.74068 51.80171 19776.92 18674.31 17750.34 2523.372 2523.372 2523.372 78.65886 29.37878 15.90677 85 0.67025741 0.9349831 0.188702427 -0.2613410 2403.582 0.2245705 0.3119865 0.2608195 2009-01-12 -0.014061295 13.371347 30.46561 39.97055 45.24210 52.16207 50.17764 19788.02 18683.05 17748.76 2524.466 2524.466 2524.466 78.58966 28.17871 14.80066 85 0.49082443 0.9958785 0.350137644 -0.2065359 2420.117 0.2217528 0.3128203 0.2615878 2009-01-13 -0.016693272 6.141462 19.52298 29.30404 35.68593 47.25383 48.32987 19772.25 18693.01 17749.35 2488.165 2488.165 2488.165 76.08326 25.34705 13.96936 80 0.26923307 0.8855971 0.457229531 -0.1845331 2434.998 0.2223591 0.3103439 0.2609330 2009-01-14 -0.047918393 2.712386 11.97834 20.69541 27.26891 42.10718 46.23469 19747.87 18694.16 17742.88 2449.353 2449.353 2449.353 75.42231 20.65686 13.99099 60 -0.01023467 0.6624063 0.498264880 -0.1131268 2445.040 0.2290943 0.3094655 0.2644883 </code></pre> <p>What I would like to do is put an <code>NA</code>during the periods when a TTR is not significant. For example if the RSI2 TTR turns out not to be significant during the first quarter I would like to replace the numerical values by <code>NA</code>s , but if the RSI2 is significant during the 5th quarter I would like to keep the numerical values.</p> <p>At the end, I should get a data frame which dimensions are the same as the intial data frame.</p> <p>Any idea? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload