中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。
- 安装
| py_dict = readLines('python_dictionary.txt') | |
| # e.g. | |
| #{"cat_name": "Ella", "dwell_status": "tree_dweller", "coat_color": "gray, white, orange", "is_from_hell": "Y"} | |
| #{"cat_name": "Billie", "dwell_status": "bush_dweller", "coat_color": "gray, white", "is_from_hell": "N"} | |
| dict_to_df = function(dict) { | |
| require(plyr) | |
| df = data.frame() | |
| df_temp = list() |
| # -------------------------------- | |
| # calculate DIC* from stanfit | |
| # | |
| # * Spiegelhalter et al. (2002) | |
| # -------------------------------- | |
| DIC <- function(stanfit, df.input, dev ){ | |
| # stanfit: stanfit object | |
| # df.input: input data.frame | |
| # dev: function that calculate the dev. of post.mean; |