BushApproval             package:UsingR             R Documentation

_U._S. _P_r_e_s_i_d_e_n_t _G_e_o_r_g_e _B_u_s_h _a_p_p_r_o_v_a_l _r_a_t_i_n_g_s

_D_e_s_c_r_i_p_t_i_o_n:

     Approval ratings as reported by six different polls.

_U_s_a_g_e:

     data(BushApproval)

_F_o_r_m_a_t:

     A data frame with 323 observations on the following 3 variables.

     _d_a_t_e The date poll was begun (some take a few days)

     _a_p_p_r_o_v_a_l a numeric number between 0 and 100

     _w_h_o a factor with levels 'fox' 'gallup' 'newsweek' 'time.cnn'
          'upenn' 'zogby'

_D_e_t_a_i_l_s:

     A data set of approval ratings of George Bush over the time of his
     presidency, as reported by several agencies. Most polls were of
     size approximately 1,000 so the margin of error is about 3
     percentage points.

_S_o_u_r_c_e:

     This is from data found at <URL:
     http://www.pollingreport.com/BushJob.htm>. The idea came from an
     article in _Salon_ <URL:
     http://salon.com/opinion/feature/2004/02/09/bush_approval/index.html>
      by James K. Galbraith.

_E_x_a_m_p_l_e_s:

     data(BushApproval)
     attach(BushApproval)

     ## Plot data with confidence intervals. Each poll gets different line type
     ## no points at first
     plot(strptime(date,"%m/%d/%y"),approval,type="n",
          ylab = "Approval Rating",xlab="Date",
          ylim=c(30,100)
          )

     ## plot line for CI. Margin or error about 3
     ## matlines has trouble with dates from strptime()
     colors = rainbow(6)

     for(i in 1:nrow(BushApproval)) {
       lines(rep(strptime(date[i],"%m/%d/%y"),2),
             c(approval[i]-3,approval[i]+3),
             lty=as.numeric(who[i]),
             col=colors[as.numeric(who[i])]
             )
       
     }

     ## plot points
     points(strptime(date,"%m/%d/%y"),approval,pch=as.numeric(who))

     ## add legend
     legend((2003-1970)*365*24*60*60,90,legend=as.character(levels(who)),lty=1:6,col=1:6)
     detach(BushApproval)

