title: From timeSpan class of SPLUS to POSIXlt class of R
body: <p>I am trying to convert <code>SPLUS</code> data with <code>timeSpan</code> class to <code>R</code> data with <code>POSIXlt</code> class. I looked into <code>lubridate</code> package, but could not find a way to do it. <code>R</code> is unable to detect <code>timeSpan</code> class, so it spits error when I tried to create a variable with the data. </p>
  
  <p>The <code>lubridate</code> package help file <code>?'lubridate-package'</code> says that </p>
  
  <blockquote>
    <p>Lubridate distinguishes between moments in time (known as instants)
    and spans of time (known as time spans, see Timespan-class). Time
    spans are further separated into Duration-class, Period-class and
    Interval-class objects.</p>
  </blockquote>
  
  <p>Also I looked for help from this <a href="http://vita.had.co.nz/papers/lubridate.pdf" rel="nofollow noreferrer">article</a> on <code>lubridate</code> written by the package developer, but could not find a way to solve it. Is it  possible to convert the <code>timeSpan</code> class of <code>SPLUS</code> to <code>posixlt</code> class in <code>R</code>?</p>
  
  <p><strong>SPLUS Data:</strong></p>
  
  <pre><code>"span" = new("timeSpan", .Data = list(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7,
      7, 30, 30, 91, 91, 365, 1826, 9131, 36525),
      c(1, 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 5000, 15000, 60000, 60000, 
      300000, 300000, 900000, 900000, 3600000, 10800000, 10800000, 21600000,
      0, 0, 0, 37800000, 37800000, 27000000, 27000000, 21600000, 21600000,
      21600000, 0)),
     .Data.names = c("julian.day", "milliseconds"),
     .Data.classes = new("CLASS",c("integer", "integer")),
     format = "%dd %Hh %Mm %Ss %NMS")
  </code></pre>
  
  <p><strong>Appearance of data after evaluation on SPLUS workbench:</strong></p>
  
  <pre><code>span
   [1] 0d 0h 0m 0s 1MS     0d 0h 0m 0s 1MS     0d 0h 0m 0s 2MS    
   [4] 0d 0h 0m 0s 5MS     0d 0h 0m 0s 10MS    0d 0h 0m 0s 25MS   
   [7] 0d 0h 0m 0s 50MS    0d 0h 0m 0s 100MS   0d 0h 0m 0s 250MS  
  [10] 0d 0h 0m 0s 500MS   0d 0h 0m 1s 0MS     0d 0h 0m 5s 0MS    
  [13] 0d 0h 0m 15s 0MS    0d 0h 1m 0s 0MS     0d 0h 1m 0s 0MS    
  [16] 0d 0h 5m 0s 0MS     0d 0h 5m 0s 0MS     0d 0h 15m 0s 0MS   
  [19] 0d 0h 15m 0s 0MS    0d 1h 0m 0s 0MS     0d 3h 0m 0s 0MS    
  [22] 0d 3h 0m 0s 0MS     0d 6h 0m 0s 0MS     1d 0h 0m 0s 0MS    
  [25] 7d 0h 0m 0s 0MS     7d 0h 0m 0s 0MS     30d 10h 30m 0s 0MS 
  [28] 30d 10h 30m 0s 0MS  91d 7h 30m 0s 0MS   91d 7h 30m 0s 0MS  
  [31] 365d 6h 0m 0s 0MS   1826d 6h 0m 0s 0MS  9131d 6h 0m 0s 0MS 
  [34] 36525d 0h 0m 0s 0MS
  </code></pre>
  
  <p><strong>Error on R console:</strong></p>
  
  <pre><code>Error in getClass(Class, where = topenv(parent.frame())) : 
    “timeSpan” is not a defined class
  </code></pre>