title: invalid type (list) for variable
body: <p>I am trying to run an anova model in R. I have a data file which contains 3 rows and 12 columns. Each row is data for a particular level of the explanatory variable. Cell [i,j] is the j'th response for level i. The file is ".dat" extension. I am running the following R code to try to get a 36 by 2 data frame to run the anova model instead of the 3 by 12 original data frame: </p>
  
  <pre><code>data &lt;- read.table("usedcar.dat", row.names = 1)
  young &lt;- data[1,]
  med &lt;- data[2,]
  old &lt;- data[3,]
  Price &lt;- c(young, med, old)
  Age &lt;- as.factor(c(rep(1,12), rep(2,12), rep(3,12)))
  data &lt;- cbind(Age, Price)
  data &lt;- as.data.frame(data)
  </code></pre>
  
  <p>But when I try to get the anova model out of it I get the invalid list type error: </p>
  
  <pre><code>m1 &lt;- aov(Price ~ Age, data = data)
  Error in model.frame.default(formula = Price ~ Age, data = data, drop.unused.levels = TRUE) : invalid type (list) for variable 'Price'
  </code></pre>
  
  <p>What am I doing wrong here? </p>
  
  <p>Here's a random matrix if that will help: </p>
  
  <pre><code>replicate(12, rnorm(3))
  </code></pre>
  
  <p>Here is the str(data) result:</p>
  
  <pre><code>str(data)
  'data.frame':   36 obs. of  2 variables:
   $ Age  :List of 36
    ..$ 1 : int 1
    ..$ 2 : int 1
    ..$ 3 : int 1
    ...
    ..$ 36: int 3
   $ Price:List of 36
    ..$ 1 : int 2300
    ...
    ..$ 36: int 2075
  </code></pre>