title: Build a dataframe conditioned to time
body: <p>I am trying to build a data frame named 'df' that registers the time stamp when each row was entered. 'df' should have a unique column:</p>
  
  <p>The data I want to input in 'df' is from data frame 'a', column 'textid':</p>
  
  <pre><code>str(a$textid)
  </code></pre>
  
  <blockquote>
    <p>chr [1:262] "xxxxx yyy" ...</p>
  </blockquote>
  
  <p>'a' is composed as:</p>
  
  <pre><code>str(a)
  </code></pre>
  
  <blockquote>
    <p>'data.frame':  262 obs. of  3 variables:
     $ V1    : chr  "Refierenos alguien que compre o arriende, si concreta obtén un ingreso extra \n\ngoo.gl/OlPYuZ" "Menciona a un amigo que quiera comprar una propiedad, si concreta, consigue dinero plus\n\ngoo.gl/OlPYuZ" "Refierenos alguien que compre o arriende, si concreta obtén un ingreso extra \n\ngoo.gl/OlPYuZ" "Menciona a un amigo que quiera comprar una propiedad, si concreta, consigue dinero plus\n\ngoo.gl/OlPYuZ" ...
     $ textid: chr "xxxxx yyyy" ...
     $ limit : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...</p>
  </blockquote>
  
  <pre><code>dput(droplevels(head(a)))
  </code></pre>
  
  <blockquote>
    <p>structure(list(V1 = c("Refierenos alguien que compre o arriende, si concreta obtén un ingreso extra \n\ngoo.gl/OlPYuZ", 
    "Menciona a un amigo que quiera comprar una propiedad, si concreta, consigue dinero plus\n\ngoo.gl/OlPYuZ", 
    "Refierenos alguien que compre o arriende, si concreta obtén un ingreso extra \n\ngoo.gl/OlPYuZ", 
    "Menciona a un amigo que quiera comprar una propiedad, si concreta, consigue dinero plus\n\ngoo.gl/OlPYuZ", 
    "Refierenos alguien que compre o arriende, si concreta obtén un ingreso extra \n\ngoo.gl/OlPYuZ", 
    "Menciona a un amigo que quiera comprar una propiedad, si concreta, consigue dinero plus\n\ngoo.gl/OlPYuZ"
    ), textid = c("xxxxx yyy", "xxxxx yyy", "xxxxx yyy", "xxxxx yyy", "xxxxx yyy", "xxxxx yyy" 
    ), limit = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)), .Names = c("V1", 
    "textid", "limit"), row.names = c(NA, 6L), class = "data.frame")</p>
  </blockquote>
  
  <p>I need a condition for time. Every row has to be input if:</p>
  
  <pre><code>if(as.integer(Sys.time()) %% 11 &amp; as.integer(Sys.time()) %% 17 != 0)
  </code></pre>
  
  <p>After the row is entered there should be a loop that should wait for the next time that Sys.Time() (coerced as an integer value) matches that condition. </p>
  
  <p>For that I have built this code:</p>
  
  <pre><code>df &lt;- c(NA)
  df &lt;- as.data.frame(matrix(c(a), nrow = nrow(a)))
  
  
  i=1
  
  while(i &lt;= nrow(a)) {
      repeat {
          if (as.integer(Sys.time()) %% 11 &amp; as.integer(Sys.time()) %% 17 != 0) {
              break
          } else {
              df[i,]&lt;- paste(Sys.time(),a$textid[i])
              i=i+1
          }
      }
  }
  </code></pre>
  
  <p>Unsuccesfully I am obtaining al df's rows at the same time with the same time stamp.</p>
  
  <pre><code>str(df)
  </code></pre>
  
  <blockquote>
    <p>'data.frame':  2982 obs. of  1 variable:
     $ c(NA): chr  "2017-07-10 13:14:58 xxxxx yyy" ...</p>
  </blockquote>
  
  <p>Then I have tried</p>
  
  <pre><code>i=1 
  while(i&lt;=nrow(ids) &amp; as.integer(Sys.time()) %% 11 == 0 &amp; as.integer(Sys.time()) %% 17 == 0) {
      df[i,]&lt;-paste(Sys.time(),a$textid[i]) 
      i=1+i
  }
  </code></pre>
  
  <p>but I get an empty 'df'.</p>
  
  <p>Finnally I am trying:</p>
  
  <pre><code>i=1
  df&lt;-as.data.frame(c(NA))
  repeat{
      if(as.integer(Sys.time()) %% 11 &amp; as.integer(Sys.time()) %% 17 == 0{
          df[i,]&lt;-paste(Sys.time(),a$textid[i])
          i=1+i
      }
    if(i&gt;nrow(ids)){
      break
    }
  }
  </code></pre>
  
  <p>But 'a's´ rows keep entering at the same time to 'df' and do not loop looking for the next condition in time that matches before entering each row.</p>
  
  <pre><code>dput(droplevels(head(df)))
  </code></pre>
  
  <blockquote>
    <p>structure(list(<code>c(NA)</code> = c("2017-07-11 16:30:46 xxxx yyyy", 
    "2017-07-11 16:30:46 xxxxx yyy", 
    "2017-07-11 16:30:46 xxxxx yyy", 
    "2017-07-11 16:30:46 xxxxx yyy", 
    "2017-07-11 16:30:46 xxxxx yyy", 
    "2017-07-11 16:30:46 xxxxx yyy"
    )), .Names = "c(NA)", row.names = c(NA, 6L), class = "data.frame")</p>
  </blockquote>
  
  <p>As you can see the time is the same for every row. What I am trying to get is something like:</p>
  
  <blockquote>
    <p>structure(list(<code>c(NA)</code> = c("2017-07-11 16:30:46 xxxx yyyy", 
    "2017-07-11 16:31:12 xxxxx yyy", 
    "2017-07-11 16:31:51 xxxxx yyy", 
    "2017-07-11 16:33:33 xxxxx yyy", 
    "2017-07-11 16:33:35 xxxxx yyy", 
    "2017-07-11 16:36:28 xxxxx yyy"
    )), .Names = "c(NA)", row.names = c(NA, 6L), class = "data.frame")</p>
  </blockquote>