爱意东升西落,浪漫至死不渝。值此七夕佳节,给大家分享一个有趣的 Stata 命令。是我特意为今年七夕编写的~
使用该命令可以 1s 中生成这样的一个「恋爱计时器」。
安装 lovingtimer 命令
这个命令被我放到了 GitHub 上,因此大家可以运行下面的代码安装:
net install lovingtimer.pkg, from("https://r-stata.github.io/lovingtimer_stata/") replace
另外也可以从附件中的源代码包安装:
net install lovingtimer.pkg, from("lovingtimer_stata 文件夹的路径") replace
运行 lovingtimer 命令
然后运行 lovingtimer 命令就可以创建一个恋爱计时器了:
lovingtimer, title("👫 From Oct. 27, 2019 to the future") firstday(2019-10-27 23:00:00)
该命令会创建一个 html 文件放在工作目录下:lovingtimer.html,也可以使用 savehtml() 选项自定义文件名字。
设置字体
由于懒得写 hlp 帮助文档,所以我习惯直接在 ado 里面写帮助文档,运行 which lovingtimer 即可查看:
which lovingtimer
*! 在 Stata 中创建一个恋爱计时器 *! 微信公众号 RStata 2023 年 8 月 20 日 *! 【用法】: *! lovingtimer string, [TItle(string) FIrstday(string) BGColor(string) TITLEFontfamily(string) TIMERFontfamily(string) SPANFontfamily(string) SAVEhtml(string)] *! 【选项】: *! title: Title. *! firstday: The first day of love. For example, "2023-01-01 01:00:00". *! bgcolor: background-color. *! titlefontfamily: Title font family. *! timerfontfamily: Timer font family. *! spanfontfamily: Font for numbers. *! savehtml: file name to be saved. *! 【示例】: *! lovingtimer, ti("From the first day to the future") firstday "2023-01-01 01:00:00"
其中选项中的大写部分表示该选项可以简写成大写部分对应的字母,例如更改背景色:
lovingtimer, title("👫 From Oct. 27, 2019 to the future") /// firstday(2019-10-27 23:00:00) /// bgc("#AC9969")
评论