mcglinnlab / shark-ray-div

Global patterns of shark and ray diversity
0 stars 1 forks source link

Successfully created for loops to change the world raster resolution,… #7

Closed EmmalineSheahan closed 7 years ago

EmmalineSheahan commented 7 years ago

… rasterize polygons at each resolution, and plot species richness at each resolution. Now that we know the code is functional we can run it at different resolutions if desired

dmcglinn commented 7 years ago

Very cool! Way to stick with it! With respect to the coding style make sure you pay strict attention to the code spacing so for example you want it to look like:

for(i in 1:10) {
    for(j in 1:10) {
        my_awesome_code = i * j
    }
} 

you don't want it to look like

for(i in 1:10) {
    for(j in 1:10) {
    my_awesome_code = i * j
    }
} 

I know this difference may seem silly and trivial but when you get into more complex coding having the indents line up is critical to quickly telling what level of nesting within a piece of code you are in the ith loop or the jth loop for example. Almost more important than having efficient code is to have code that is easy for other humans (including your future self) to read and decipher. Here is a style guide that I generally adhere to: http://adv-r.had.co.nz/Style.html

I'll hold off on merging this code until you get those loops lined up correctly otherwise it looks great.

dmcglinn commented 7 years ago

Looks great nice job!

dmcglinn commented 7 years ago

Remember to execute git pull upstream master