Advertisement

Data Management

  • Robert A Muenchen
Chapter
Part of the Statistics and Computing book series (SCO)

Transforming Variables

Unlike SAS, R has no separation of phases for data modification (data step) and analysis (proc step). It is more like SPSS where as long as you have data read in, you can modify it. Anything that you have read into or created in your R workspace you can modify at any time.

R performs transformations such as adding or subtracting variables on the whole variable at once, as do SAS and SPSS. It calls that vector arithmetic. R has loops, but you do not need them for this type of manipulation.

R can nest one function call within any other. This applies to transformations as well. For example, taking the log of our q4 variable and then getting summary statistics on it, you have a choice of a two-step process like:mydata$q4Log <- log(mydata$q4)summary( mydata$q4Log )

Or you could simply nest the log function within the summary function:summary( log( mydata$q4 ) )

If you planned to do several things with the transformed variable, saving it under a new name would lead to...

Keywords

Data Frame Aggregate Function Data Editor Character Vector Logical Comparison 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Copyright information

© Springer Science+Business Media, LLC 2009

Authors and Affiliations

  • Robert A Muenchen
    • 1
  1. 1.University of TennessceKnoxvilleUNA

Personalised recommendations