R措辞编码规矩(国外英文资料).docVIP

  • 5
  • 0
  • 约5.67万字
  • 约 14页
  • 2017-06-08 发布于河南
  • 举报
R措辞编码规矩(国外英文资料)

R语言编码规则(国外英文资料) R language is a mainly used for statistical computing and graphics programming language. The R language encoding style guide is designed to make our R code easier to read, share and check. The following rules and Google R user group collaborative design.? Summary: R coding style conventions 1. file naming: end with.R? 2. identifier naming: , FunctionName, kConstantName? 3. single line length: no more than 80 characters 4. indentation: two spaces, without tabs 5. blank 6. curly braces: the front brackets are not broken, the lines are written, and the back brackets are exclusive 7. assignment symbol: use left, rather than =?? 8. semicolon: do not use 9. overall layout and order Note: all 10. criteria to comment? #?, followed by a space; inline comments in #?? with two spaces 11. function definition and call 12. function document 13. sample function 14. TODO writing style: TODO (your user name) Summary: R language usage rules 1. attach: avoid use 2. function: error (error) should be used. Stop (). Throw 3. objects and methods: avoid using S4 objects and methods as much as possible; never mix S3 and S4 Representation and naming File naming The filename should end with .R (uppercase). The name of the file itself is meaningful Example:? Predict_ad_revenue.R Counter example? Foo.R Identifier naming Do not use the underscore in identifiers (_??) or a hyphen (-?). Identifiers should be named according to the Convention. The following variables should be the point of use (.) separating all lowercase letters or words; the function name, initials, no separate (including word capitalized); with the constant naming rules function, but need to use a k? At the beginning. V? Example: avg.clicks? Counterexample: avg_Clicks, avgClicks? FunctionName? Example: CalculateAvgClicks? Counterexample: calculate_avg_clicks, calculateAvgClicks? The function name should be a verb or a verb phrase Exception: when you create an object with class (class) attributes, the function na

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档