欢迎加入 TidyFriday !
现在加入即可享受 8 折优惠! See: https://czxa.top/posts/34814/
After two days of tireless submission, I finally received the passed reply at noon today!
I’ve tried to write a lot messy R packages, all left on my GitHub @czxa. These R packages are so unstable that they can’t be installed on other people’s computer. In recently months, I have tried to rewrite them, but I haven’t done it yet. An important part of this work if translate all Chinese into English(really tired, feeling like work for foreigners).
As my first submission on CRAN, I feel so excited that I couldn’t wait to write down this blog to share my experience and lessons in the process of submission.
I developed the R Package using RStudio.
Note 1: Don’t use Chinese in R packages.
Chinese may be considered as ‘non-ASCII’ characters. This means your packages can’t be installed on Windows OS.
After your packages is written, it can be checked by RStudio.
Before checking, Configure the building tool. Fill
Check Package - R CMD check additional options with
--as-cran, which means to check in accordance with CRAN requirements. Then click ‘OK’.
Come back to the main panel of RStudio, click
Check to check your R package, The best result is
0 errors ✔ | 0 warnings ✔ | 0 notes ✔. Errors are unacceptable. If there are any errors. I’m sure it can’t pass CRAN’s pre-check.
No errors in the result of the check doesn’t mean that it’s truly no problem. Further check need to be carried out next.
Build Source Package. It can be operated on interface or use the following commands:
The last line of results tells you where ‘hwordcloud_0.1.0.tar.gz’ is.
Open your terminal, run:
R CMD check /Users/czx/Documents/我的项目/hwordcloud_0.1.0.tar.gz --as-cran
The result is:
* checking CRAN incoming feasibility ... WARNING
This is a warning result, it was because I just submitted version 0.1.0. However, before this submission, the result is a NOTE message.
This check also generates a folder named
hwordcloud.Rcheck. There is a
hwordcloud-manual.pdf in it, which is your package document. If you use Chinese in your Packages, the compilation of this PDF document will fail. There is also a
00check.log file it, which is a log file. You can find detailed errors, warnings and notes of the check.
Next, Submit the package source to CRAN:
Submit step by step:
After finishing step 3, you will receive a email from CRAN in 10 minutes to six hours, this email is to let you confirm your submission.
Click on this link to confirm your submission:
After about a minute, you will receive a feedback email.
Continue to wait. Next, CRAN will run a pre-check on your submitted packages. This pre-check is more stringent than the check just made at our terminal, mainly checking iterms in
Description file. It should be noted that:
titleiterm should be in title-format, for example:
Rendering Word Clouds;
Descriptionshould contains more than one sentence, without any spelling errors. Package names, software names and API names should be enclosed in single quotation marks, just like the response I received:
Please write package names, software names and API names in single quotes (e.g. ‘shiny’) in your Description.
DESCRIPTIONfile, such as mine:
License: MIT + file LICENSE. Correspondingly, There is a license file in your package with contents like following:
That’s all. I’ve finally become one in ten thousand of CRAN, and I’m honored to have these cute tags:
This first one is generated by using Travis deployment, and the second one is the lastest version of this package on CRAN. The last three will show the downloads of this package through CRAN.
The page link of the ‘hwordcloud’ package on CRAN is: hwordcloud @CRAN
The Package document link of this package is: hwordcloud.pdf
I also wrote a vignette to introduce the basic usages of this packages: Rendering Word Clouds
Now, you can just use
install.packages("hwordcloud") to install this package!
A very simple example:
I built nine themes in the package: darkgreen/darkblue/avocado/darkunica/gray/gridlight/grid/sandsignika/sunset, for example, theme
hwordcloud(text = df$word, size = df$freq,
You can explore the rest by yourself.
As for other parameters, here is a complete example:
hwordcloud(text = df$word, size = df$freq,
To present the usage of ‘hwordcloud’ intuitively, I wrote a simple shiny applications, you can run it by executing following codes:
dir <- system.file("examples", "hwordcloud", package = "hwordcloud")
In fact, I also wrote a Chinese vignette, see: 使用R和HighCharts渲染词云图.
You can get Chinese shiny application by running following codes:
Welcome to install and provide suggestions for further improvement.
Update your browser to view this website correctly. Update my browser now