Page 48 - Applied Statistics Using SPSS, STATISTICA, MATLAB and R
P. 48

1.8 Software Tools   27
































           Figure 1.12. An illustration of R on-line help of function mean. The “Help on
           ‘mean’” is displayed in a specific window.

              An R data frame is a recipient for a list of objects. We mostly use data frames
           that are simply data matrices with appropriate column  names, as in the above
           matrix m .
              Operations on data are obtained by using suitable R functions. For instance,

              > mean(x)
              [1] 3.5

           displays the mean value of the x  vector on the console. Of course one could also
           assign this mean value to  a new  variable, say  mu  ,  by  issuing  the  command
           mu <- mean(x)   .
              Whenever  needed one may obtain the information on which objects are
           currently in the console environment by using ls()(“list”). (Be sure to include the
           parentheses; otherwise R will interpret it as you wishing to obtain the ls   function
           code.) Object removal is performed by applying the function rm (“remove”) to a
           list of  object identifiers. For instance,  rm(x)   removes matrix  x  from the
           environment; it will no longer be available.
              On-line  help  about  general topics  of R, namely command constructs and
           available functions, can be obtained from the Help menu option of the R Gui. On-
           line help about a specific function can be obtained using the R help function as
           illustrated in Figure 1.12.
   43   44   45   46   47   48   49   50   51   52   53