title: Output .txt file with single max value of two vectors
body: <p>Looking to output the number of unique id and time periods for each id into a .txt file.</p>
  
  <p>Right now I have:</p>
  
  <pre><code>#Store N and T_Max (ie. Maximum number of periods per individual)
  library(plyr)
  mydata$id &lt;- as.numeric(as.factor(mydata$ncountry))
  N_max &lt;- max(mydata$id)
  mydata$count&lt;-do.call(c, lapply(unique(mydata$id), function(curf){
  seq(sum(mydata$id==curf))
  }))
  T_max &lt;- max(mydata$count)
  mydata$T_max &lt;- rep(T_max,nrow(mydata)) # make new column 
  mydata$N_max &lt;- rep(N_max,nrow(mydata)) # make new column 
  myvars1 &lt;- c("T_max","N_max")
  unique(myvars1)
  newdata1 &lt;- mydata[myvars1]
  write.table(newdata1, "NT_input.txt", col.names=FALSE, row.names=FALSE, sep=" ")
  </code></pre>
  
  <p>Which gives the following style of .txt file:</p>
  
  <pre><code>194 15
  194 15
  194 15
  194 15
  .
  .
  .
  </code></pre>
  
  <p>I would only like a single row of output, ie:</p>
  
  <pre><code>194 15
  </code></pre>
  
  <p>Any advice is appreciated. Thank you.</p>