Copy HTML to Run R Code ExampleAbout 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.
<!-- The Start of exploreNESdataset.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+Explore+contents+of+dataset+and+variable+in+dataset%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0Alibrary%28%22poliscidata%22%29%0A%23+You+need+to+load+the+poliscidata+package+each+time+at+the+start+of+each+session%2Fscript.%0A%23+You+should+also+always+set+a+working+directory%2C+but+this+demo+script+is+running+on+a+remote+server.%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%0A%23+Commands+to+explore+an+object%2C+such+as+the+NES+dataset%0Acat%28%22Number+of+rows+in+NES+dataset%3A%5Cn%22%29%0Anrow%28nes%29%0A%0Acat%28%22%5Cn%5CnNumber+of+columns+in+NES+dataset%3A%5Cn%22%29%0Ancol%28nes%29%0A%0Acat%28%22%5Cn%5CnDimensions+of+the+NES+dataset%3A%5Cn%22%29%0Adim%28nes%29%0A%0A%23+Look+at+info+recorded+in+the+first+row+of+the+NES+dataset.%0A%23+These+responses+come+from+one+of+the+people+who+participated+in+the+NES+survey.%0A%23+To+make+it+easier+to+read%2C+we+can+transpose+the+row+into+a+column+with+the+t%28%29+function.%0A%0Acat%28%22%5Cn%5CnValues+recorded+in+NES+dataset%2C+row+1%3A%5Cn%22%29%0At%28nes%5B1%2C%5D%29"></iframe>
<!-- End of exploreNESdataset.txt R Demo Code -->