{"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

The featured image comes from https:\/\/blog.codinghorror.com\/new-programming-jargon\/ <\/a>where the concept of Egyptian Brackets is explained.<\/p>\n

Graham @ Microsoft<\/p>\n","protected":false},"excerpt":{"rendered":"

This was originally shared as a Revolution Analytics Blog Post on 25th October 2016. 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 […]<\/p>\n","protected":false},"author":2,"featured_media":705,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/posts\/698"}],"collection":[{"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/comments?post=698"}],"version-history":[{"count":5,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/posts\/698\/revisions\/929"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/media\/705"}],"wp:attachment":[{"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/togaware.com\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}