[R] creating a new variable.

R. Michael Weylandt michael.weylandt at gmail.com
Tue Mar 19 09:29:17 CET 2013


On Tue, Mar 19, 2013 at 4:33 AM, Nicole Ford <nicole.ford at me.com> wrote:
>
> Hello, all.
>
> The following is for my own research.
>
> I have attached the relevant data in pdf from Transparency International.  I am only interested in the "CPI 2010 scores" column.
>
> I am interested in creating a variable for several of these countries.  The idea is, they will become a country level aggregate IV "corruption".  I am running models on about 10 countries, individually.  The DV will be essentially "democracy" with some other controls.
>
> I have the dv coded and need help with the IV.
>
> I am interested in how to create a new variable for CPI.  This is new to me. I have created some variables (some complex some not so complex) but usually I do not need to create variables my own variables from scratch so I really don't know how to do this.  I looked online but have not been able to find anything relevant.  I am sure something is out there and I am missing it.
>
> CPI is ranked 1-10.  10= least amount of corruption, 1 being the most.  It is continuous.
>
> For example, Russia is ranked at 2.1; how would I create a variable for Russia?  Once I get one, I know I will get the others.

How is that 2.1 calculated?

You might want the ?transform or ?within functions if it's easily
expressed as a function of other variables in your data frame.

MW

>
> Any direction would be very helpful:  a link, command, etc.
>
> Thanks in advance.
>
>
> ~Nicole Ford
> Ph.D. student
> Graduate Assistant/ Instructor
> University of South Florida
> Government and International Affairs
> office: SOC 012M
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list