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 "Create a Simple Graphic" Demo
See This R Demo | See More R Demos
Copy HTML Code for "Create a Simple Graphic" Demo
See This R Demo | See More R Demos
Copy HTML Code for "Create a Simple Graphic" Demo
See This R Demo | See More R Demos
<!-- The Start of createSimpleGraphic.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=%23+This+sample+code+creates+objects%2C+performs+computations%2C+and+produces+a+graphic.%0A%23+Try+changing+the+value+of+thisIntercept+and+thisSlope+%0A%0A%23+Assigning+Values+to+Objects%0AthisIntercept+%3D+0%0AthisSlope+%3D+-1%0AsimDataX+%3D+runif%2820%2C+-10%2C+10%29%0A%0A%23+Performing+Computations+with+Objects%0AsimDataY+%3D+thisIntercept+%2B+thisSlope%2AsimDataX+%2B+runif%2820%2C+-10%2C+10%29%0A%0A%23+Creating+Graphics%0Aplot%28x%3D%22%22%2C+y%3D%22%22%2C+xlim%3Dc%28-10%2C10%29%2C+ylim%3Drange%28simDataY%29%2C+xlab%3D%22X+Values%22%2C+ylab%3D%22Y+Values%22%29%0Aabline%28a%3DthisIntercept%2C+b%3DthisSlope%29%0Apoints%28x%3DsimDataX+%2C+y%3DsimDataY%2C+col%3D%22red%22%29%0Aabline%28lm%28simDataY+%7E+simDataX%29%2C+col%3D%22red%22%29"></iframe>

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