rescale               package:plotrix               R Documentation

_r_e_s_c_a_l_e

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

     'rescale' performs a simple linear conversion of 'x' into the
     range specified by 'newrange'. Only numeric vectors with some
     variation will be accepted.

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

      rescale(x,newrange)

_A_r_g_u_m_e_n_t_s:

       x: A numeric vector.

newrange: The minimum and maximum value of the range into which 'x'
          will be scaled.

_V_a_l_u_e:

     On success, the rescaled vector.

_A_u_t_h_o_r(_s):

     Jim Lemon

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

      # scale one vector into the range of another
      normal.counts<-tabulate(cut(rnorm(100),breaks=seq(-3,3,by=1)))
      normal.density<-rescale(dnorm(seq(-3,3,length=100)),range(normal.counts))
      # now plot them
      plot(c(-2.5,-1.5,-0.5,0.5,1.5,2.5),normal.counts,type="h")
      lines(seq(-3,3,length=100),normal.density)

