标签:
praise包就一个功能:赞你!
直接安装:
install.packages("praise")
从github上安装:
library(devtools) install_github("gaborcsardi/praise")
用法:
praise(template = "You are ${adjective}!")
使用随机的单词替换adjective来赞美你!
> library(praise)
> praise() [1] "You are fine!" > praise() [1] "You are divine!" > praise() [1] "You are best!" > praise() [1] "You are fantastic!" > praise() [1] "You are wonderful!" > praise() [1] "You are fantabulous!" > praise() [1] "You are splendid!"
可以看到,预设的赞美格式是You are ${adjective}!,此外还可以自定义格式!
## 首字母大写 > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Yay! This program is lovely!" > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Gee! This package is glorious!" > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Yahoo! This program is super!" > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Mhm! This package is fantastic!" > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Yippie! This project is fine!" > praise("${Exclamation}! This ${rpackage} is ${adjective}!") [1] "Ahh! This R package is super!"
## 所有字母大写 > praise("${EXCLAMATION}! You have done this ${adverb_manner}!") [1] "HUZZAH! You have done this really!" > praise("${EXCLAMATION}! You have done this ${adverb_manner}!") [1] "AHHH! You have done this enthusiastically!" > praise("${EXCLAMATION}! You have done this ${adverb_manner}!") [1] "HURRAY! You have done this warmly!" > praise("${EXCLAMATION}! You have done this ${adverb_manner}!") [1] "OLE! You have done this kindly!" > praise("${EXCLAMATION}! You have done this ${adverb_manner}!") [1] "HO-HO! You have done this swiftly!"
其中 ${EXCLAMATION} 、${adjective}以及 ${adverb_manner},可以理解为包中的词库,分别表示感叹和情态,每个词库里面都含有数量不等的用于称赞你的词语!
查看可用词库:
> names(praise_parts) [1] "adjective" "adverb" "adverb_manner" "created" "creating" "exclamation" "rpackage"
打开R安装位置里的etc文件夹中的配置文件Rprofile.site文件:
这个文件里,设置的内容包括默认编辑器,CRAN镜像选取,自动加载包等等。
在打开Rprofile.site文档的最后加上如下代码:
.First <- function(){ library(praise) cat(praise("${EXCLAMATION}! ${EXCLAMATION}! Handsome man,you have done this ${adverb_manner}!"),"\n",praise(),"\n",praise(),"\n",date(),"\n") }
重启RStudio则显示如下:
本文链接:
http://www.cnblogs.com/homewch/p/5749850.html
标签:
原文地址:http://www.cnblogs.com/homewch/p/5749850.html