title: Lme error: "Error in reStruct"
body: <p>4 beehives were equipped with sensors that collected temp, humidity, pressure, decibels inside the hive. these are the response variables.</p>
  
  <p>the treatment was wifi exposure, the experimental groups were exposed to wifi from day 1 to day 20, then again from day 35-45, and data was collected until day day 54. n of hives = 4, n of data collected by sensors in each hive = ~million.</p>
  
  <p>I am having difficulties running mixed effects models. </p>
  
  <p>there is a data frame of all the hives' response variables.</p>
  
  <pre><code>names(Hives)
  [1] "time"           "dht22_t"        "dht11_t"        "dht22_h"       
  [5] "dht11_h"        "db"             "pa"             "treatment_hive"
  [9] "wifi"   
  </code></pre>
  
  <p>time is in "%Y-%m-%d %H:%M:%S", dht11/22_t/h are either temperature and humidity data.  "wifi" is a dichotomous variable (1=on 0=off) that corresponds to the time of exposure, and treatment hive is another dichotomous variable for the hives exposed to wifi (1=exposure, 0=control). </p>
  
  <p>Here is the error i am getting. </p>
  
  <pre><code>attach(Hives)
  model2 = lme(pa_t~wifi*treatment_hive, random=time, na.action=na.omit, method="REML",)
  
  Error in reStruct(random, REML = REML, data = NULL) : 
  Object must be a list or a formula
  </code></pre>
  
  <p>Here is a sample of the code:</p>
  
  <pre><code>    time    dht22_t dht11_t dht22_h dht11_h db  pa  treatment_hive  wifi
  1   01/09/2014 15:19    NA      NA  NA      NA  51.75467    NA      0   1
  2   01/09/2014 15:19    30.8    31  59.8    44  55.27682    100672  0   1
  3   01/09/2014 15:19    30.8    31  60.3    44  54.81995    100675  0   1
  4   01/09/2014 15:19    30.8    31  60.9    44  54.14134    100671  0   1
  5   01/09/2014 15:19    30.8    31  61.1    44  53.88574    100672  0   1
  6   01/09/2014 15:19    30.8    31  61.2    44  53.68800    100680  0   1
  </code></pre>
  
  <p>R version 2.15.1 (2012-06-22)
  Platform: i486-pc-linux-gnu (32-bit)<br>
  attached packages:
  [1] ggplot2_0.8.9   proto_0.3-9.2   reshape_0.8.4   plyr_1.7.1      nlme_3.1-104<br>
  [6] lme4_0.999999-0 Matrix_1.0-6    lattice_0.20-6 </p>