Here’s a link to my first useful plot using ggplot2.
I found this tutorial to be extremely helpful for getting up and running quickly.
Slightly off-topic: This R Markdown shows how to make and apply a theme when using lattice graphics. The advantage is that the same theme can be used repeatedly, reducing the need to insert formatting commands into graphics statements and allowing for consist formatting to be applied to multiple graphs.
This R Notebook illustrates how to subset a dataframe into two groups (male and female), fit separate regression lines, add the regression lines to a scatterplot, fit a multiple regression model with two lines, and fit a multiple regression model with parallel lines. Finally, ggplot2 is used for scatterplot smoothing. Cool stuff!
In preparation for our next meeting, I set about learning some basics of ggplot 2, and I constructed an RPub based upon the things that I learned. The RPub link is here:
This RPub is a very basic introduction, but I plan on learning more of the bells and whistles for upcoming RPubs that I’d like to write.
One note for creating RPubs using Mac OS: I was encountering a stubborn error when I was trying to knit my R Markdown. When I went onto the message boards, I found that my version of the MacOS removes some of the X11 library during updates. When you try running programs that open a graphics window, you will get an error message. You will need to reinstall XQuartz from the weblink that pops up in the error message in RStudio.
This was our first general meeting.
Nathan Wolfe, Drew Kerkhoff, PJ Glandon, Brad Hartlaub, Chris Bickford, Kathy Gillen, Jen McMahon, Beth Schultz, Karen Hicks, Siobhan Fennessy
We went around the table for introductions and expressions of interest. Multiple people cited interest in “improving my teaching of R”, graphing, and learning R techniques in a social setting.
Brad Hartlaub walked us through a couple of examples of R activities and assignments. (See the related blog posts: 1, 2, 3.) These demonstrated the use of R Notebooks, and the simplicity of publishing those notebooks to a personal (but public) area in RPubs.
Discussion topics included:
Running code easily can create a black box, especially if code is shared – how do we make sure students are learning stats, and not just running scripts until they get a graph that looks good?
There are R packages that are not in the default load for Kenyon computers. This can add a setup task as required packages may need to be loaded on classroom machines. (Our group should compile a list of desired packages and communicate them to LBIS.)
Publishing your notebooks creates interesting issues around scholarly and classroom openness. What data do you share? Are you worried about plagiarism? Or data privacy?
RPubs does not have a rating or classification system, which means it can be tricky to discover and assess documents in it. How can you tell if a particular document is worthwhile? Right now, much of this is based on considering how you found it – who linked to the doc, from where, and do you trust that source.
Plans for next time:
Next time we’ll look at the ggplot2 package for creating graphics. (Karen Hicks mentioned a good book she consults when using ggplot, and I forgot to write down its title.)
There was some interest in discussing GitHub as a tool for sharing R documents among collaborators (like a lab group). Joe Murphy volunteered to give a general introduction to GitHub at a future meeting, and start looking at how it handles R documents.
Other topics of interest for future meetings included:
Alton Barbehenn produced this summary during a Spring 2017 independent study, where he finished the remaining chapters in Nonparametric Statistical Methods by Hollander and Wolfe. Cool stuff!
Here is a notebook that we used to introduce our data analysis students to R notebooks. This is a very basic review to go along with Chapter 0 in Stat2: Building Models for a World of Data by Cannon, Cobb, Hartlaub, Legler Lock, Moore, Rossman, and Witmer.
Here is a very simple simulation activity to help students understand what to look for in Normal Q-Q Plots.
I took the following steps to create it:
The purpose of this meeting was to discuss the group’s purpose and who would participate.
Chris Gillen, Brad Hartlaub, Joe Murphy, Drew Kerkhoff, PJ Glandon
Kenyon R User’s Group Mission Statement (first draft)
The R Users group is composed of faculty and staff of Kenyon College who use the R programming language in their teaching and/or research. Members discuss nifty strategies, vexing challenges, and shiny new features available in R. Conversations focus on using R and teaching with it, not on the content of courses or scholarship. Users of all levels of expertise are welcomed, but the group is not intended to teach basic R skills.
2/21 – Drew and PJ will lead a conversation about how to document and share the code and other resources we discuss. Brad will show how his classes are using notebooks. This will remain a small group. In addition to the current group, we will invite Abbie Erler, Marie Snipes, Erika Farfan, and Jen McMahon to get feedback from a broader group.
3/28 and 4/18 – We consider opening these meetings to everyone else in the Kenyon community.