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 mappingCorrelations.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%0A%0A%23+We+are+going+to+map+the+thermometer+subjects+based+on+their+correlations%0AvariableSet+%3D+cbind%28liberals%3Dnes%24ftgr_liberals%2C+feminists%3Dnes%24ftgr_feminists%2C+%0A++++++++++++++++++++big_biz%3Dnes%24ftgr_bigbus%2C++++military%3Dnes%24ftgr_military%2C+%0A++++++++++++++++++++atheists%3Dnes%24ftgr_atheists%2C+gays%3Dnes%24ftgr_gay%2C%0A++++++++++++++++++++asians%3Dnes%24ftcasi_asian%2C%0A++++++++++++++++++++illegal_imm%3Dnes%24ftcasi_illegal%2C%0A++++++++++++++++++++supreme_court%3Dnes%24ftgr_ussc%2C%0A++++++++++++++++++++muslims%3Dnes%24ftgr_muslims%2C%0A++++++++++++++++++++mormons%3Dnes%24ftgr_mormons%2C%0A++++++++++++++++++++hillary_clinton%3Dnes%24ft_hclinton%2C%0A++++++++++++++++++++blacks%3Dnes%24ftcasi_black%2C%0A++++++++++++++++++++democrats%3Dnes%24ft_dem%2C%0A++++++++++++++++++++republicans%3Dnes%24ft_rep%2C%0A++++++++++++++++++++obama%3Dnes%24obama_therm%2C%0A++++++++++++++++++++whites%3Dnes%24ftcasi_white%2C%0A++++++++++++++++++++catholics%3Dnes%24ftgr_catholics%2C%0A++++++++++++++++++++congress%3Dnes%24ftgr_congress%2C%0A++++++++++++++++++++poor%3Dnes%24ftgr_poor%2C%0A++++++++++++++++++++rich%3Dnes%24ftgr_rich%2C%0A++++++++++++++++++++john_roberts%3Dnes%24ftpo_roberts%2C%0A++++++++++++++++++++tea_party%3Dnes%24ftgr_tea%2C%0A++++++++++++++++++++unions%3Dnes%24ftgr_unions%2C%0A++++++++++++++++++++christians%3Dnes%24ftgr_xian%2C%0A++++++++++++++++++++welfare%3Dnes%24ftgr_welfare%2C%0A++++++++++++++++++++conservatives%3Dnes%24ftgr_cons%2C%0A++++++++++++++++++++working_class%3Dnes%24ftgr_working%2C%0A++++++++++++++++++++middle_class%3Dnes%24ftgr_middle%0A++++++++++++++++++++%29+%0A%23+We+will+focus+on+the+correlations+only+%0A%23+For+simplicity%2C+rounding+the+results+to+2+decimal+places%0Acorr_matrix+%3D+wtd.cor%28variableSet%2C+weight%3Dnes%24wt%29%24correlation%0A%0A%23+creating+a+map+%0Adist_matrix+%3D+1+-+corr_matrix%0Aplot%28smacof%3A%3Amds%28dist_matrix%2C+ndim%3D2%29%2C+main%3D%22Multi-Dimensional+Scaling+of+Feeling+Thermometers%22%29%0A"></iframe>
<!-- End of mappingCorrelations.txt R Demo Code -->