根据 CRAN,什么构成了一个好的包名? [英] What constitutes a good package name according to CRAN?

查看:63
本文介绍了根据 CRAN,什么构成了一个好的包名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为要发送给 CRAN 的 R 包搜索好名字.我没有找到任何关于 R 包命名的良好实践的信息.有一篇关于如何分析包名称的帖子,但它没有回答我的问题.还有 CRAN 包的字母顺序列表,但它只显示存在的内容,这在实践中并不是什么好事.

I'm searching a good name for a R package I want to send to the CRAN. I didn't find any information about good practice in R package namming. There is a post about how to analyze packages names but it don't answer my question. There is also the alphabetical list of CRAN packages but it only show what exists, not what is good in practice.

选项是:

  • 大小 :保持名称简短(8 个字符或更少),然后使用 library(thepack) 很容易调用,但可能不像 the_next_package;
  • Camel Style : 使用 Camel Style (eg thePack) 来分割单词,但用户在调用时有拼错的风险它区分大小写(library(thepack) 不等于 library(thePack)) ;
  • 特殊字符:使用."等特殊字符;或_"拆分单词(e.g. the_packthe.pack),但我觉得它们不优雅
  • R 字母 :添加一个大写的 R 表示这是一个 R 包(eg RpacktheRpack) 但我们遇到了与 Camel Style 相同的问题.
  • Size : Keep the name short (8 characters or less) then it's easy to call with library(thepack) but maybe not mayningfull as the_next_package ;
  • Camel Style : use Camel Style (e.g. thePack) to split the words but with the risk for the user to misspell it when calling it's case-sensitive (library(thepack) is not equal to library(thePack)) ;
  • Special character : using special characters like "." or "_" to split the words (e.g. the_pack or the.pack) but I don't find them elegant
  • R letter : add an upper case R to indicate that's an R package (e.g. Rpack or theRpack) but we have the same problem than with the Camel Style.

这可能是一个微不足道的问题,但我认为包的名称很重要,因为它是包和用户之间的第一次交互.然后在使用 library() 函数调用时必须同时有意义、简洁且易于编写.

It's maybe a trivial question but I think the name of a package is important because its the first interaction between the package and the user. Then must be in the same time meaningful, concise and easy to write when called with the library()function.

推荐答案

编写 R 扩展 仅提供以下约束:

必填的包"字段给出了包的名称.这应该只包含 (ASCII) 字母、数字和点,至少有两个字符,以字母开头,不能以点结尾.

请注意,不允许使用下划线字符 _.

Note that the underscore character, _, is not allowed.

您可以通过检查列表此处来开始您的研究-特别是,很少有包名包含点字符,..

You might start your research by examining the listing here - in particular, few package names include the dot char, ..

另外,查看这个问题以获得一些有用的代码.更重要的是,@agstudy 在 这里.

Also, take look at this SO question for some helpful code. What's more, @agstudy provided a link to Hadley Wickham's tips on his favorite package naming conventions here.

顺便说一下,如果您打算将包提交给 CRAN,如果不合适,CRAN 团队可能会建议更改名称.

By the way, in case you're planning to submit the package to CRAN, the CRAN team might suggest a name change if it's not appropriate.

这篇关于根据 CRAN,什么构成了一个好的包名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆