Organization source code

15 months ago by

How are people organizing their source code.  My .rhistory files are quite disorganized.  Are people creating a new .rhistory file or organizing it in a word document?

5 Answers

15 months ago by

I may not be of much help here since I mostly worked in Python - but for my one R file I simply am using Git as the repository and history record.  ".Rhistory" seems to record every line change - which seems like overkill to me except for undo/redo in R Studio.  

So my 'organization':

--GIT history of changes

--Final report file includes list of scripts and their meaning

--Hopefully scripts are reasonably commented

After looking at it I don't think I would keep the '.Rhistory' file - just commit to Git often enough that if you mess up a file you can get an older copy and do a text comparison.


15 months ago by

Hi Emil

In my professional career, most of my colleagues discourage the use of .RHistory files in source control due to their potential size and persistent change. Most of our build engineers treat them the same as binaries and typically discourage their inclusion in our source control systems (GIT). 

15 months ago by

Hi Emil,

For my project, I am using R and GitHub for the final deliverable. I have all of my work separated into various R scripts, summary report on the about page, and instructions will be included in the readme file about reproducing the results using the scripts. Basically, as long as the data clean script is run first, the rest of the models and visualizations should run without problem. I am also pushing some of my output visualizations and the summary report to Git as well.
I am not really including a history of all the stuff I tried to do. Where pertanent, I will probably talk about some of the history/reasoning for why I did this or that in my presentation on Friday. 
15 months ago by

I am using a .R file and I have it organized to match my analysis process (which is how I am setting up my presentation).

I broke mine in sections: all packages used and loaded, data loaded and cleaned up, analysis, and results plus any visuals.

I added comments to break up each section and describe what is going on in each section with more emphasis in each step of analysis.

I will upload this to my GitHub once completed.

I am editing this file as I work through various packages that I try and am keeping it to what I am discussing in the presentation.

Hope this helps,



15 months ago by

Organized scripts or R jupyter notebook are good. Uploading Rhistory directly isn't a good idea since there can be unnecessary commands: Instead, you may select necessary commands (in a correct order) from rhistory and copy & paste to your r script.


Please login to add an answer/comment or follow this question.

Similar posts:
Search »