HIPERFIT / recipes

Financial Recipes
MIT License
2 stars 4 forks source link

Introducing an R style guide #8

Closed oleks closed 8 years ago

oleks commented 8 years ago

@dybber @annenkov

oleks commented 8 years ago

@annenkov @dybber :+1: if you think this is a OK for merge.

rolfpoulsen commented 8 years ago

đź‘Ť

Den 15. mar. 2016 kl. 17.36 skrev Oleks notifications@github.com<mailto:notifications@github.com>:

@annenkovhttps://github.com/annenkov @dybberhttps://github.com/dybber [:+1:] if you think this is a OK for merge.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/HIPERFIT/recipes/pull/8#issuecomment-196911702

dybber commented 8 years ago

Looks good! :+1:

0-indexing vs. 1-indexing should maybe be mentioned. 1-indexing is R's default, but because of personal preferences I tend to still use zero-based indexing in LaTeX-equations, which can get confusing. We should probably stick with 1-indexing everywhere.

rolfpoulsen commented 8 years ago

I’m also a ”0-indexing man”, and R’s 1-indexing embarrassingly often confuses me. There appears to be no easy fix, possibly because it would mess up R’s convenient element removal feature, as illustrated thus:

x [1] 1 2 3 4 5 x[-1] [1] 2 3 4 5 With 0-indexing x[-0] would not equal x[0] In short: I’m with Martin, let’s use 0-indexing “in the maths”, the default 1-indexing in code, and give a small remark on it. Best regards, Rolf

From: Martin Dybdal [mailto:notifications@github.com] Sent: 15 March 2016 22:57 To: HIPERFIT/recipes Cc: Rolf Poulsen Subject: Re: [recipes] Introducing an R style guide (#8)

Looks good! [:+1:]

0-indexing vs. 1-indexing should maybe be mentioned. 1-indexing is R's default, but because of personal preferences I tend to still use zero-based indexing in LaTeX-equations, which can get confusing. We should probably stick with 1-indexing everywhere.

— You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/HIPERFIT/recipes/pull/8#issuecomment-197043617

henglein commented 8 years ago

0-indexing has been argued for by Dijkstra: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html; see also handwritten original https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF. (The "mathematical colleague" he refers to at the end is reputed to be de Bruijn.) F

On Tue, Mar 15, 2016 at 11:24 PM, rolfpoulsen notifications@github.com wrote:

I’m also a ”0-indexing man”, and R’s 1-indexing embarrassingly often confuses me. There appears to be no easy fix, possibly because it would mess up R’s convenient element removal feature, as illustrated thus:

x [1] 1 2 3 4 5 x[-1] [1] 2 3 4 5 With 0-indexing x[-0] would not equal x[0] In short: I’m with Martin, let’s use 0-indexing “in the maths”, the default 1-indexing in code, and give a small remark on it. Best regards, Rolf

From: Martin Dybdal [mailto:notifications@github.com] Sent: 15 March 2016 22:57 To: HIPERFIT/recipes Cc: Rolf Poulsen Subject: Re: [recipes] Introducing an R style guide (#8)

Looks good! [:+1:]

0-indexing vs. 1-indexing should maybe be mentioned. 1-indexing is R's default, but because of personal preferences I tend to still use zero-based indexing in LaTeX-equations, which can get confusing. We should probably stick with 1-indexing everywhere.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub< https://github.com/HIPERFIT/recipes/pull/8#issuecomment-197043617>

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/HIPERFIT/recipes/pull/8#issuecomment-197051867

oleks commented 8 years ago

On Tue, Mar 15, 2016 at 10:57 PM, Martin Dybdal notifications@github.com wrote:

Looks good! [image: :+1:]

0-indexing vs. 1-indexing should maybe be mentioned. 1-indexing is R's default, but because of personal preferences I tend to still use zero-based indexing in LaTeX-equations, which can get confusing. We should probably stick with 1-indexing everywhere.

But isn't that a matter for a "style guide" for the surrounding Markdown and LaTeX? Which would probably be great to integrate into this document, but isn't what this document originally is about. This is exclusively about R, ATM.

So, should we make one, unified style guide for Notebooks and source code?