Perhaps something like this: > idx <- 1:2 > lm(as.matrix(iris[idx]) ~., iris[-idx])
Call: lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx]) Coefficients: Sepal.Length Sepal.Width (Intercept) 3.682982 3.048497 Petal.Length 0.905946 0.154676 Petal.Width -0.005995 0.623446 Speciesversicolor -1.598362 -1.764104 Speciesvirginica -2.112647 -2.196357 On Nov 23, 2007 10:09 AM, Morgan Hough <[EMAIL PROTECTED]> wrote: > Hi there, > > I am analyzing a table of brain volume measures where each brain area > (183 of them) is a column with a label and volume values. I have another > table of explanatory variables (age, gender, diagnosis and > IntraCranialVol) that I have been using to model the brain volume > differences. I have been doing this for single volume measures with no > difficulties but I have been unable to apply this across the whole set > of brain areas. If I try: > > lm(y.df, x.df) > Error in eval(expr, envir, enclos) : object "Left_Lateral_Ventricle" not > found > > Left_Lateral_Ventricle happens to be the first column label. Does this > not work with tables? I have been unable to find any examples. > > Would you recommend another approach if I was doing this again. The > number of columns (brain areas) depends on the parcellation strategy we > use so I will probably be reforming these tables again and again. I > would like the simplest way to analyze all the brain areas and find > where there are significant differences driven mainly by the diagnosis > factor. > > Thanks in advance for your time. > > Cheers, > > -Morgan > > --------------------------------------------------------------------------- > Morgan Hough, > D.Phil. Student, > Oxford University FMRIB Centre > > FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK > +44 (0) 1865 222466 (fax 222717) > [EMAIL PROTECTED] http://www.fmrib.ox.ac.uk/~mhough > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.