[R] Finding a mean value of a variable holding a dummy variable fixed

From: Alexander Ovodenko <ovodenko_at_princeton.edu>
Date: Sun, 30 Mar 2008 21:47:13 -0400

I have time-series data on approval ratings of British Prime Ministers. The prime ministers dating from MacMillan onward till today are coded as dummy variables and the approval ratings are entered for each month. I want to know the mean value of the approval rating of each Prime Minister in the dataset and the approval rating during his/her first month and last month as PM. What R code should I enter for these data? In other words, I want hold the dummy corresponding to each Prime Minister fixed at value one and know the first rating that PM has, the last rating s/he has, and the mean rating s/he has. Thanks.

        [[alternative HTML version deleted]]

R-help_at_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. Received on Mon 31 Mar 2008 - 02:07:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 31 Mar 2008 - 04:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive