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
re-superstructure
monitor
edited Nov 5 "17 at 21:44
nbk
asked Nov 5 "17 at 21:19

*

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

2 answers 2


active earliest Votes
19
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():

dd
re-publishing
monitor
edited Nov 5 "17 at 21:46
answer Nov 5 "17 in ~ 21:39

*

Ben BolkerBen Bolker
184k2222 yellow badges330330 silver- badges405405 bronze badges
2
include a comment |
8
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.


share
monitor
answered Apr 21 "18 at 15:23
*

TripartioTripartio
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
Linked
0
Weird error ns cannot get approximately in R for random Forests
related
610
The difference in between bracket < > and twin bracket << >> for accessing the elements of a list or dataframe
446
exactly how to amount a variable by team
592
convert a list to a data framework
336
how to inspect if thing (variable) is identified in R?
631
How deserve to I see the resource code for a function?
1
Error in model.frame.default ..... : invalid type (list) for variable
0
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.


*

lang-r
ridge Overflow
commodities
company
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.