transformC {RCPA3} | R Documentation |
Returns new variables by transforming existing dataset variables (e.g. dummy variables, standardized variables, rank orders)
Description
Given a variable x, the transformC
function generates and returns a tranformed version of x. For example, transformC
can take a variable x and return standardized x, or the log of x.
Usage
transformC(type, x, data, response, cutpoints, groups, confirm = TRUE, ...)
Arguments
type |
The type of transformation to be made to x. Options include:
|
x |
The variable to be transformed, a variable that already exists, should be in dataset$var form unless dataset specified in optional data argument. |
data |
(Optional) Name of dataset that contains x variable. |
response |
(Optional) For |
cutpoints |
(Optional) For |
groups |
(Optional) For |
confirm |
(Optional) By default, |
... |
(Optional) Additional arguments pass to |
Value
A transformed version of x variable, a vector with the same length as x, unless type="dummy.set"
in which case transformC returns a data.frame.
RCPA3 Package Tutorial Videos
-
Transforming Variables with RCPA3 Package's transformC Function 22:40
-
Complete Playlist of RCPA3 Package Tutorial Videos, includes video for this function and many more.
Textbook References
Philip H. Pollock and Barry C. Edwards, An R Companion to Political Analysis, 3rd Edition (Thousand Oaks, CA: Sage Publications, Forthcoming 2022), Chapter 3.
Philip H. Pollock and Barry C. Edwards, The Essentials of Political Analysis, 6th Edition (Thousand Oaks, CA: Sage Publications, 2020), pp. 55-64. ISBN-13: 978-1506379616; ISBN-10: 150637961.
Online Resources
-
R Tutorials & Resources for Creating and Transforming Variables, Compiled by Barry C. Edwards
-
Sage Edge Resources for Political Analysis Series, for streaming videos, flashcards, and more student resources for textbooks by Pollock and Edwards, from Sage Publications.
-
Political Science Data Web Site: Find datasets for your own research and resources to help with the analysis.
Examples
library(RCPA3)
# don't use confirm=FALSE until you've tested the function call
transformC("percent.rank", nes$ft.dem, confirm=FALSE)
transformC("rank", nes$ft.dem, confirm=FALSE)
transformC("whole", runif(min=0,max=100,n=20), confirm=FALSE)