, 10 tweets, 4 min read Read on Twitter
So many scientific results rely on code written by an inexperienced programmer and is NEVER EVER seen by anyone else. We can surely do better.

Thread 1/n
First, data and code behind published papers must be public (except for justified reasons). It's unbelievable that we have to blindly trust what is said in a paper without being able to look inside. And yes, that happens so often pnas.org/content/115/11… 2/n
Failure to publish data and code means errors never get caught (or take years of unnecessary struggles e.g. physicstoday.scitation.org/do/10.1063/PT.…).
And no one else can ever build upon those data and code, hindering scientific progress 3/n
Many scientists are afraid to show their code b/c it may contain errors. Of course we may be wrong!
The solution is NOT hiding our code but showing it early and often, be willing to fix it & value people who correct themselves (even published papers) nature.com/news/2010/1010… 4/n
Academia must embrace code review within and outside research teams ropensci.org/blog/2018/11/2….
Most results are based on code written & seen by a SINGLE PERSON EVER.
Even if you ask coauthors to have a look at your code, very rarely anyone peeks. No checks, no feedback. 5/n
However, most coauthors will put a lot of effort in polishing the manuscript in a Word doc with inserted figs and tables. What if there are mistakes in code, and the story is based on incorrect results? We should care more about this 6/n
Of course, code review is hard and takes time, especially w/ messy code written by inexperienced programmers.
Many more scientists could be taught how to write good and robust code: defensive programming, literate programming, version control, etc 7/n
To sum up: we should better care for code behind scientific results. Train researchers to write good code, and ensure it's seen, revised, improved by others. No shaming for honest errors, since everyone can make mistakes. Value people who share, review, and fix their code. 8/8
Sb asked what one can do to minimize errors in code. What I do (in #rstats):

-Invest on learning stats & programming

-Version control everything: data, code, results

-Use assertr github.com/ropensci/asser… to check data

-Use testthat testthat.r-lib.org to test functions
1/2
-Use continuous integration (eg. Travis) to automatically test & update everything (ncbi.nlm.nih.gov/pmc/articles/P…)

-Write reproducible manuscripts in Rmarkdown rmarkdown.rstudio.com

-Publish data & code when submitting ms as the latest

More good advice here doi.org/10.1371/journa…
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to F Rodriguez-Sanchez
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!