Skip to content
Prev 306524 / 398506 Next

Running different Regressions using for loops

Hi,

Yes the thing that you provided...works fine....but probably I should have
asked for some other thing.

Here is what I am trying to do....

I am trying to get the mean of Price variable....so I am entering the
below function:

         mean(names(lm.list2[[2]]$coefficient[2] ))

but this gives me an error....

	[1] NA
	Warning message:
	In mean.default(names(lm.list2[[2]]$coefficient[2])) :
  	argument is not numeric or logical: returning NA

I thought by getting the text from the list variable...will help me
generate the mean for that text...which is a variable in the data...say
Price 1, Media 2....and so on

Is this a proper approach...if it is...then something more needs to be
done with the function that you provided.

If not, is there a better way...to generate the mean of a particular
variable inside the " for loop " used earlier...given below:
Thanks & Regards,

Krunal Nanavati
9769-919198


-----Original Message-----
From: Rui Barradas [mailto:ruipbarradas at sapo.pt]
Sent: 28 September 2012 16:02
To: Krunal Nanavati
Cc: David Winsemius; r-help at r-project.org
Subject: Re: [R] Running different Regressions using for loops

Hello,

Try

names(lm.list2[[2]]$coefficient[2] )

Rui Barradas
Em 28-09-2012 11:29, Krunal Nanavati escreveu:
which is stored in"