R语言-赞你包_praise包

(2017-07-08 银河统计)

前言

  praise包就一个功能:赞你!

目录

 1. praise包安装

 2. praise包开启赞你模式


1. praise包安装

# 直接安装:
	install.packages("praise")

# 从github上安装:
	library(devtools)
	install_github("gaborcsardi/praise")

2. 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" 

参考资料

posted @ 2017-07-08 10:52  银河统计  阅读(963)  评论(0编辑  收藏  举报