Percentile Rank
An example application for calculating percentile ranks, (*1)
Installation
Create a folder for your project and enter it, (*2)
mkdir percentilerank-example && cd "$_"
Pull the project files, (*3)
composer create-project michaeltintiuc/percentilerank-example .
Usage
When running application via Web Server set the Document Root to public/, (*4)
Run application via CLI, (*5)
php public/index.php
Create the application with a parser (csv or json), (*6)
/**
* @param string type of parser
*/
$app = new MichaelT\App('csv');
Load file to be read by the parser, (*7)
/**
* @param string path to file
*/
$app->parser()->loadFile(__DIR__.'/../input.csv');
Calculate percentile rank from file data, (*8)
/**
* @param string|int index/key of score of interest
* @param string|int index/key to hold percentile rank
*/
$data = $app->calculateRank(2, 'rank');
Save result to file via created parser, (*9)
/**
* @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);