ns am trying to run an anova design in R. I have a data document which contains 3 rows and 12 columns. Each heat is data for a particular level the the explanatory variable. Cell is the j"th solution for level i. The paper is ".dat" extension. Ns am to run the following R code to shot to gain a 36 by 2 data framework to operation the anova model instead of the 3 through 12 initial data frame:

data but when I try to gain the anova model out of that I obtain the invalid list kind error:

m1 What am ns doing wrong here?

Here"s a random procession if that will certainly help:

replicate(12, rnorm(3))Here is the str(data) result:

str(data)"data.frame": 36 obs. That 2 variables: $ period :List that 36 ..$ 1 : int 1 ..$ 2 : int 1 ..$ 3 : int 1 ... ..$ 36: int 3 $ Price:List the 36 ..$ 1 : int 2300 ... ..$ 36: int 2075
r anova
edited Nov 5 "17 at 21:44
asked Nov 5 "17 at 21:19


47311 yellow badge55 silver badges1818 bronze title
| show 3 more comments

2 answers 2

active earliest Votes
tl;dr rows the data frames are lists, not numeric vectors. Once you read.table() you acquire a data structure (so constructing a matrix, as I walk before, doesn"t replicate the problem).

You are watching: Invalid type (list) for variable

data The truth that this is a list, no a numeric vector, is a problem.There room a range of ways of handling this. The simplest is unlist():

edited Nov 5 "17 at 21:46
answer Nov 5 "17 in ~ 21:39


Ben BolkerBen Bolker
184k2222 yellow badges330330 silver- badges405405 bronze badges
include a comment |
The error blog post invalid type (list) because that variable x native the lm or other formula-based functions generally suggests that change x is expecting a vector, yet instead is a list. A standard model for debugging the error is to examine the result of str(data_frame_name$x) (where data_frame_name is the data framework that has x). Usually, girlfriend would uncover that x is not fairly the data type that friend expect.

answered Apr 21 "18 at 15:23

1,69911 yellow badge2121 silver badges2727 bronze title
add a comment |
Highly active question. Knife 10 reputation (not count the combination bonus) in order to answer this question. The reputation requirement helps safeguard this question from spam and also non-answer activity.

Not the price you're feather for? Browse various other questions tagged r anova or ask your own question.

The Overflow Blog
Featured top top Meta
Weird error ns cannot get approximately in R for random Forests
The difference in between bracket < > and twin bracket << >> for accessing the elements of a list or dataframe
exactly how to amount a variable by team
convert a list to a data framework
how to inspect if thing (variable) is identified in R?
How deserve to I see the resource code for a function?
Error in model.frame.default ..... : invalid type (list) for variable
invalid form (list) for variable 'train_data'
warm Network questions an ext hot questions
concern feed
i ordered it to RSS
concern feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


ridge Overflow
ridge Exchange Network
site style / logo © 2021 stack Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.12.22.41046

See more: Heroku: " No Default Language Could Be Detected For This App.

Stack Overflow works finest with JavaScript enabled

her privacy

By clicking “Accept all cookies”, girlfriend agree stack Exchange deserve to store cookie on your an equipment and disclose details in accordance v our Cookie Policy.