michaeltintiuc / percentilerank-example
百分位数排名计算器示例。
v0.0.5
2017-01-25 20:46 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-29 01:40:53 UTC
README
计算百分位数的示例应用程序。
安装
为您的项目创建一个文件夹并进入它
mkdir percentilerank-example && cd "$_"
拉取项目文件
composer create-project michaeltintiuc/percentilerank-example .
使用方法
通过Web服务器运行应用程序时,将Document Root设置为 public/
通过 CLI
运行应用程序
php public/index.php
使用解析器(csv或json)创建应用程序
/** * @param string type of parser */ $app = new MichaelT\App('csv');
加载解析器要读取的文件
/** * @param string path to file */ $app->parser()->loadFile(__DIR__.'/../input.csv');
从文件数据计算百分位数排名
/** * @param string|int index/key of score of interest * @param string|int index/key to hold percentile rank */ $data = $app->calculateRank(2, 'rank');
通过创建的解析器将结果保存到文件
/** * @param string path to file * @param array data to save * @param string|int|array key/index of array to skip */ $app->parser()->exportFile(__DIR__.'/../output.csv', $data, 0);