title: Cannot coerce class ....to a data.frame error
body: <p>R subject</p>
  
  <p>I have an "cannot coerce class "c("summary.turnpoints", "turnpoints")" to a data.frame" error when trying to save the summary in a file. I have tried to fix that with as.data.frame with no success.</p>
  
  <p>code :</p>
  
  <pre><code>library(plyr)
  library(pastecs)
  
   data &lt;- read.table("C:\\Users\\Ron\\Desktop\\dataset.txt", header=F, col.name="A")
   data.tp=turnpoints(data$A)
   print(data.tp)
  </code></pre>
  
  <p>Turning points for: data$A </p>
  
  <pre><code>nbr observations  : 5990 
  nbr ex-aequos     : 51 
  nbr turning points: 413 (first point is a pit)
  E(p) = 3992 Var(p) = 1064.567 (theoretical)
  </code></pre>
  
  <p>Turning points for: data$A </p>
  
  <pre><code>nbr observations  : 5990 
  nbr ex-aequos     : 51 
  nbr turning points: 413 (first point is a pit)
  E(p) = 3992 Var(p) = 1064.567 (theoretical)
  
  
   data.sum=summary(data.tp)
   print(data.sum)
  
      point type        proba      info
  1      11  pit 7.232437e-15  46.97444
  2      21 peak 7.594058e-14  43.58212
  3      30  pit 3.479857e-27  87.89303
  4      51 peak 5.200612e-29  93.95723
  5      62  pit 7.594058e-14  43.58212
  6      70 peak 6.213321e-14  43.87163
  7      81  pit 6.276081e-16  50.50099
  8      91 peak 5.534016e-23  73.93602
  .....................................
  
  write.table(data.sum, file = "C:\\Users\\Ron\\Desktop\\datasetTurnP.txt")
  
  Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
    cannot coerce class "c("summary.turnpoints", "turnpoints")" to a data.frame
  In addition: Warning messages:
  1: package ‘plyr’ was built under R version 3.0.1 
  2: package ‘pastecs’ was built under R version 3.0.1 
  </code></pre>
  
  <p>How can I save these summary results to a text file?</p>
  
  <p>Thank you.</p>