A comment on my blog post of last week suggested just that. Reason enough to explore Python a little. Learning another computer language is like learning another human language – it takes time. Often it is helpful to start by translating from the new language back into the old one.
It is only a small Python script, but it illustrated how to:
- load packages
- use conditional statements
- add comments
- write functions
- deal with arrays
- write loops
- create plots
- save output into a PDF file
Here is my translation into R, which actually generated the plot above.
R version 3.1.2 (2014-10-31)<br />Platform: x86_64-apple-darwin13.4.0 (64-bit)<br /><br />locale:<br /> en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8<br /><br />attached base packages:<br /> stats graphics grDevices utils datasets methods <br /> base <br /><br />other attached packages:<br /> signal_0.7-4 e1071_1.6-4 <br /><br />loaded via a namespace (and not attached):<br /> class_7.3-11 MASS_7.3-35 tools_3.1.2 <br />