• R语言已解决
  • 求助:ecce 包增加了汉字拼音标注函数,可是提交到 CRAN 没通过

ecce 包仓库:https://gitlab.com/chuxinyuan/ecce
CRAN反馈检查结果:https://win-builder.r-project.org/incoming_pretest/ecce_2.0.4_20230902_115953/Windows/00check.log

我把检查结果中关键的两条摘出来:

  • checking R files for non-ASCII characters ... WARNING
    Found the following file with non-ASCII characters:
    pinyin.R
    Portable packages must use only ASCII characters in their R code,
    except perhaps in comments.
    Use \uxxxx escapes for other characters.

  • checking R code for possible problems ... NOTE
    pinyin: no visible binding for global variable 'aux'
    pinyin: no visible binding for global variable 'tones'
    pinyin: no visible binding for global variable 'num'
    Undefined global functions or variables:
    aux num tones

我现在不知道怎么修复这两个问题,请教下各位,谢谢!

问题已解决,提交后很快就登陆CRAN:https://CRAN.R-project.org/package=ecce

具体解决措施如下:

  • 针对 pinyin.R 代码中的非 ASCII 字符,主要是以下代码
  df = data.frame(
    ym = c("a", "e", "i", "o", "u", "_"),
    tones = c("āáǎàa", "ēéěèe", "īíǐìi", "ōóǒòo", "ūúǔùu", "_")
  )

已修改为如下代码:

  df = data.frame(
    ym = c("a", "e", "i", "o", "u", "_"),
    tones = c(
      "\u0101\u00e1\u01ce\u00e0a",
      "\u0113\u00e9\u011b\u00e8e",
      "\u012b\u00ed\u01d0\u00eci",
      "\u014d\u00f3\u01d2\u00f2o",
      "\u016b\u00fa\u01d4\u00f9u",
      "_"
    )
  )
  • 针对全局变量num没有可见的绑定

我把 dplyr 那一套全部改成 base R,解决了问题还减少了依赖。开发 R 包还是尽量用 base R 那一套更好。

    12 天 后

    jlhnihao 这个确实不是很友好,blastula 包在这一点上做的很好,值得学习,后续我继续改进。

    1 年 后