FIND DATA: By Author | Journal Archives | Sites   ANALYZE DATA: Help with R | Stata | Excel   WHAT'S NEW? US Politics | Int'l Relations | Law & Courts
   FIND DATA: By Author | Journal | Sites   WHAT'S NEW? US Politics | IR | Law & Courts
Copy HTML to Run R Code Example
About This Page
This page displays HTML code you can use to embed a live demonstration of the R Statistics Program for political science research. These live online examples are easy to use and are great for teaching online classes.
Copy HTML Code for "Creating an Indicator Variable" Demo
See This R Demo | See More R Demos
Copy HTML Code for "Creating an Indicator Variable" Demo
See This R Demo | See More R Demos
Copy HTML Code for "Creating an Indicator Variable" Demo
See This R Demo | See More R Demos
<!-- The Start of creatingIndicator.txt R Demo Code -->
<!-- Copy and paste this snippet into your web page  -->
<!-- Modify border, width, and height attributes of the iframe as necessary -->

<iframe border=0 width=100% height=1200 src="https://rdrr.io/snippets/embed/?code=library%28poliscidata%29++%23+run+every+time%0A%0A%23+Creating+a+numeric+indicator+variable%0Agss%24veteran+%3D+gss%24vetyears+%21%3D+%22NONE%22++++%23+Any+years+of+service+yields+TRUE%0Agss%24veteran+%3D+as.numeric%28gss%24veteran%29+++%23+TRUE+and+FALSE+values+now+1s+and+0s%0A%0A%23+the+freq+dist+tables+not+strictly+necessary+but+you+should+check+your+work%0Acat%28%22Frequency+Distribution+Table+%28Original+Variable%29%3A%5Cn%22%29%0Afreq%28gss%24vetyears%2C+plot%3DF%29+++++++++++++%23+Make+sure+indicator+variable+correct%0A%0Acat%28%22%5CnFrequency+Distribution+Table+%28New+Variable%29%3A%5Cn%22%29%0Afreq%28gss%24veteran%2C+plot%3DF%29++++++++++++++%23+by+comparing+frequencies"></iframe>

<!-- End of creatingIndicator.txt R Demo Code -->