https://github.com/pzhaonet/sinx
One of the funniest things I found when I (as a Windows user) leant Ubuntu was that there is a command fortune, which prints a random/pseudorandom message from a database of quotations. It is said that this old feature has been available since 1970s. It was a pity that this feature was unavailable in boring Windows OS, until the R community developed in 2012 a package called 'fortunes,' which displays funny messages taken from the talks or communications in the R community. It supports external database as well. Unfortunately, it does not support Chinese texts, probably because (1) the 'fortunes' package cannot read multibyte characters such as Chinese, and (2) no one contributes Chinese database of fortunes.
It is a great loss, as fortunes actually come from Chinese restaurants.
R has been developing very rapidly in the Chinese community in recent years. There are online Chinese forums such as the Capital of Statistics, annually organized R conference in China, and numerous books on R. Many interesting 'fortunes' are hidden there. What if bring them into a 'fortunes'-like package? Or bring some more fun into it?
It is a pity that the 'fortunes' package is read-only. Therefore, I develop a brand new package, called 'sinx'. It displays fortunes in any language, only if a database is available.
The name originated from the name cosx, which is the domain of the Capital of Statistics. sin(x) is the derivative of -cos(x), or I would like to explain 'sinx' as 'Sino Xmen Said'.
I designed a logo for 'sinx', which can be printed on a T-shirt.
Briefly speaking, the current features of 'sinx' are as follows.
?sinx().?cscx().?tanx().?secx().?ctanx()Here is an example, which prints randomly a poem by the top poet Li Bai, in the cowsay mode (spoken by a frog):
libs <- read.sinxs(lib = c("tangshi", "songshi", "chinese", "yangsheng", "english","jinyong"))
tanx(sinxs.data = libs)
#>
#>
#> -----
#> 风吹柳花满店香,吴姬压酒唤客尝。
#> 金陵子弟来相送,欲行不行各尽觞。
#> 请君试问东流水,别意与之谁短长。
#>
#> --- 李白 (金陵酒肆留别)
#> ------
#> \
#> \
#> (.)_(.)
#> _ ( _ ) _
#> / \/`-----'\/ \
#> __\ ( ( ) ) /__
#> ) /\ \._./ /\ (
#> )_/ /|\ /|\ \_( [nosig]
More details can be found on the online documentation.
'sinx' is developed in R language.
In the future, more features will be brought into 'sinx' as follows.
Anyone can get in touch with me by leaving me a reply on steem or on https://github.com/pzhaonet/sinx.