{"id":698,"date":"2016-12-13T09:30:21","date_gmt":"2016-12-12T22:30:21","guid":{"rendered":"http:\/\/togaware.com\/?p=698"},"modified":"2021-03-05T16:57:06","modified_gmt":"2021-03-05T05:57:06","slug":"sharing-our-r-programs-with-style","status":"publish","type":"post","link":"https:\/\/togaware.com\/sharing-our-r-programs-with-style\/","title":{"rendered":"Sharing our R Programs \u2014 With Style"},"content":{"rendered":"
This was originally shared as a Revolution Analytics Blog Post<\/a> on 25th October 2016.<\/p>\n Programming is an art and a way we express ourselves. As we write our programs we should keep in mind that someone else is very likely to be reading it. We can facilitate the accessibility of our programs through a\u00a0clear presentation of the messages we are sharing.<\/p>\n As data scientists we also practice this art of programming. Indeed even more so we aim to share the narrative of our discoveries through our living and breathing of data through programming over the data. Writing programs so that others understand why and how we analysed our data is crucial. Data science is so much more than simply building black box analyses and models and we should be seeking to expose and share the process and particularly\u00a0the knowledge that is discovered from the data.<\/p>\n Style is important in making the code we share readily accessible. Dictating a style to others is a sensitive issue. We thrive on our freedom to innovate and to express ourselves how we want but we also need consistency in how we do that and a style guide supports that. A style guide also helps us journey through a new language, providing\u00a0a foundation for developing, over time, our own style in that language.<\/p>\n Through a\u00a0style guide we share\u00a0the tips and tricks for communicating clearly through our programs. We communicate through\u00a0the language \u2014\u00a0a language that also happens to be executable by a computer. In this language we follow precisely specified syntax to develop sentences, paragraphs, and whole stories. Whilst there is infinite leeway in how we express ourselves in any language\u00a0we can\u00a0share a common set of principles as our style guide.<\/p>\n Over the years styles developed for very many different languages have evolved together with the medium for interacting with computers. I have a\u00a0style guide for R<\/a>\u00a0that presents my personal and current<\/em> choices. This is the style guide I suggest (even require) for projects I lead.<\/p>\n I hope the guide might be useful to others. It augments the other R style guides out there by providing the rationale for my choices.<\/em>\u00a0Irrespective of whether specific style suggestions suit you or not, choose your own and use them consistently. Do focus on communicating with others\u00a0in the first instance and secondarily\u00a0on the execution of your code (though critical it is). \u00a0Think of writing programs as writing narratives for others to read, to enjoy, to learn from and to build upon. It is a creative act to communicate well with our colleagues \u2014\u00a0be creative with style.<\/p>\n Hands On Data Science:\u00a0Sharing R Code \u2014\u00a0With Style<\/a><\/p>\n