{"id":686,"date":"2011-11-22T18:43:31","date_gmt":"2011-11-22T18:43:31","guid":{"rendered":"https:\/\/blogs.swarthmore.edu\/institutional-research\/?p=686"},"modified":"2023-09-13T15:41:15","modified_gmt":"2023-09-13T15:41:15","slug":"visualizing-survey-results-class-discussion-by-class-year","status":"publish","type":"post","link":"https:\/\/blogs.swarthmore.edu\/institutional-research\/?p=686","title":{"rendered":"Visualizing Survey Results: Class Discussion by Class Year"},"content":{"rendered":"<p><a title=\"bryer.org\" href=\"http:\/\/bryer.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jason Bryer<\/a>, a fellow IR-er at Excelsior College has a nice post (<a title=\"visualizing-likert-items\" href=\"http:\/\/bryer.org\/2011\/visualizing-likert-items\" target=\"_blank\" rel=\"noopener noreferrer\">link<\/a>) about techniques for visualizing Likert-type items &#8211; those &#8220;Strongly disagree&#8230;Strongly agree&#8221; items only found on surveys. \u00a0He has even been developing an R software package called <a title=\"jbryer's irutils on github\" href=\"https:\/\/github.com\/jbryer\/irutils\" target=\"_blank\" rel=\"noopener noreferrer\">irutils<\/a> that bundles these visualization functions together with some other tools sure to be handy for anyone working with higher ed data.<\/p>\n<p>Jason&#8217;s post reminded me that I have been meaning to try out a &#8220;<a href=\"http:\/\/had.co.nz\/ggplot\/plot-templates.html\" target=\"_blank\" rel=\"noopener noreferrer\">fluctuation plot<\/a>&#8221; to visualize some recent survey results. \u00a0A fluctuation plot, despite the flashy name, simply creates a representation of tabular data where rectangles are drawn proportional to the sizes of the cells of the table. \u00a0The plot below has responses to a question about how often students here participate in class discussion along the left side and class year along the bottom. \u00a0The idea behind this is to have a quick and very intuitive way to visualize how this item differs (or doesn&#8217;t differ) by class year. \u00a0In this case, it looks like fewer of our sophomores (as a percentage) report participating in class discussion &#8220;very often&#8221; than their counterparts. \u00a0This may suggest a need for further research. \u00a0For example, are there differences in the kinds of courses (seminar vs. lecture) taken by sophomores?<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/ClassDiscussion1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-703\" title=\"Class Discussion by Class Year\" src=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/ClassDiscussion1.png\" alt=\"\" width=\"791\" height=\"652\" srcset=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/ClassDiscussion1.png 791w, https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/ClassDiscussion1-300x247.png 300w\" sizes=\"(max-width: 791px) 100vw, 791px\" \/><\/a><\/p>\n<p><strong>Creating the plot<\/strong><\/p>\n<p>The plot itself requires only one line of code in R. \u00a0If you are not a syntax person, I recommend massaging the data as much as possible in a spreadsheet first. \u00a0You can take advantage of a default setting in R where text strings are converted to &#8220;<a title=\"Quick-R Factors Page\" href=\"http:\/\/www.statmethods.net\/input\/valuelabels.html\" target=\"_blank\" rel=\"noopener noreferrer\">factors<\/a>&#8221; automatically. \u00a0This default functionality usually annoys the daylights out of R programmers, but in this case, it is actually exactly what you want.<\/p>\n<p>All you need to do is set up your data like this:<\/p>\n<p><a href=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/Fluctuation-Data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-691\" title=\"Fluctuation Data\" src=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/Fluctuation-Data.png\" alt=\"\" width=\"313\" height=\"230\" srcset=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/Fluctuation-Data.png 313w, https:\/\/blogs.swarthmore.edu\/institutional-research\/wp-content\/uploads\/2011\/11\/Fluctuation-Data-300x220.png 300w\" sizes=\"(max-width: 313px) 100vw, 313px\" \/><\/a>Then you can save the file as a .csv and import it into R using my preferred method &#8211; the lazy method:<\/p>\n<p><span style=\"color: #ff0000; font-family: Courier New;\">mydata&lt;-read.csv(file.choose())<\/span><\/p>\n<p>Nesting <span style=\"color: #ff0000; font-family: Courier New;\">file.choose()<\/span> inside of the <span style=\"color: #ff0000; font-family: Courier New;\">read.csv()<\/span> function brings up a GUI file chooser and you can just select your .csv file that way without having to fiddle with pathnames.<\/p>\n<p>Once you&#8217;ve done this, you just need to load (or <a title=\"Quick-R Link\" href=\"http:\/\/www.statmethods.net\/interface\/packages.html\" target=\"_blank\" rel=\"noopener noreferrer\">install then load<\/a>) the <a title=\"ggplot2 page\" href=\"http:\/\/had.co.nz\/ggplot2\/\" target=\"_blank\" rel=\"noopener noreferrer\">ggplot2<\/a> package and you can plot away like this:<\/p>\n<p><span style=\"color: #ff0000; font-family: Courier New;\">ggfluctuation(table(mydata$Response, mydata$Year))<\/span><\/p>\n<p>You can add a title, axis labels, and get rid of the ugly default legend by adding some options:<\/p>\n<p><span style=\"color: #ff0000; font-family: Courier New;\">ggfluctuation(table(mydata$Response, mydata$Year)) + opts(title=&#8221;Participated in class discussion&#8221;, \u00a0legend.position=&#8221;none&#8221;) + xlab(&#8220;Class year&#8221;) + ylab(&#8220;&#8221;)<\/span><\/p>\n<p>Once you&#8217;ve done that, you&#8217;ll have just enough time left to prepare yourself for the holiday cycle of overeating-napping in front of the TV-overeating some more. \u00a0My family will be having our traditional feast of turkey AND lasagna. \u00a0If your life so far has been deprived of this combination, I suggest seeking out someone of Southern Italian heritage and inviting yourself over for dinner. \u00a0But be warned &#8211; you may be required to listen to Mario Lanza records during the meal.<\/p>\n<p><strong><em>Happy Thanksgiving!<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jason Bryer, a fellow IR-er at Excelsior College has a nice post (link) about techniques for visualizing Likert-type items &#8211; those &#8220;Strongly disagree&#8230;Strongly agree&#8221; items only found on surveys. \u00a0He has even been developing an R software package called irutils that bundles these visualization functions together with some other tools sure to be handy for &hellip; <a href=\"https:\/\/blogs.swarthmore.edu\/institutional-research\/?p=686\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Visualizing Survey Results: Class Discussion by Class Year<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/posts\/686"}],"collection":[{"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=686"}],"version-history":[{"count":41,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":1568,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions\/1568"}],"wp:attachment":[{"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.swarthmore.edu\/institutional-research\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}