24#include "../kernel.hpp"
72 long long int nLines = _data.
getLines(sTable);
73 long long int nCols = _data.
getCols(sTable);
75 std::vector<std::vector<double>> vStats (
STATS_FIELD_COUNT, std::vector<double>());
89 for (
long long int j = 0; j < nCols; j++)
111 for (
long long int i = 0; i < nLines; i++)
164 return _lang.
get(
"STATS_TYPE_CONFINT");
166 return _lang.
get(
"STATS_TYPE_STDERR");
176 return _lang.
get(
"STATS_TYPE_SKEW");
178 return _lang.
get(
"STATS_TYPE_EXCESS");
214 int nCol = _data.
getCols(sTable);
216 const int nPrecision = 4;
223 sOut[i] =
new std::string[nCol];
228 for (
int j = 0; j < nCol; j++)
233 sOut[nHeadlines + nLine + 0][j] =
"<<SUMBAR>>";
244 for (
int i = 0; i < nHeadlines; i++)
246 if (sHeadline.length())
248 sOut[i][j] = sHeadline.substr(0, sHeadline.find(
'\n'));
250 if (sHeadline.find(
'\n') != std::string::npos)
251 sHeadline.erase(0, sHeadline.find(
'\n') + 1);
258 for (
int i = 0; i < nLine; i++)
262 sOut[i + nHeadlines][j] =
"---";
270 sOut[nHeadlines + nLine + 0][j] =
"<<SUMBAR>>";
316 int nCol = _data.
getCols(sTable);
318 const int nPrecision = 4;
329 sOverview[i] =
new std::string[nCol+1];
331 sOverview[0][0] =
" ";
335 for (
int j = 0; j < nCol; j++)
340 for (
int i = 0; i < nHeadlines; i++)
342 if (sHeadline.length())
344 sOverview[i][j+1] = sHeadline.substr(0, sHeadline.find(
'\n'));
346 if (sHeadline.find(
'\n') != std::string::npos)
347 sHeadline.erase(0, sHeadline.find(
'\n') + 1);
366 sOverview[nHeadlines + n][j+1] =
"--- %";
368 sOverview[nHeadlines + n][j+1] =
"---";
378 sOverview[nHeadlines + n][j+1] =
toString(vStats[n][j], nPrecision) +
" %";
380 sOverview[nHeadlines + n][j+1] =
toString(vStats[n][j], nPrecision);
398 delete[] sOverview[i];
425 std::string sSavePath;
452 std::string sDatatable =
"data";
462 std::vector<std::vector<double>> vStats =
calcStats(_data, sDatatable);
466 if (sTarget.length())
468 for (
size_t i = 0; i < vStats.size(); i++)
470 for (
size_t j = 0; j < vStats[i].size(); j++)
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class represents the central memory managing instance. It will handle all tables and clusters,...
std::string matchTableAsParameter(const std::string &sExpression, char cFollowing=' ')
std::vector< mu::value_type > med(const std::string &sTable, std::string sDir) const
std::vector< mu::value_type > avg(const std::string &sTable, std::string sDir) const
mu::value_type getElement(int _nLine, int _nCol, const std::string &_sTable) const
int getHeadlineCount(const std::string &_sTable) const
bool isValidElement(long long int _nLine, long long int _nCol, const std::string &_sTable) const
std::vector< mu::value_type > min(const std::string &sTable, std::string sDir) const
std::vector< mu::value_type > norm(const std::string &sTable, std::string sDir) const
std::vector< mu::value_type > pct(const std::string &sTable, std::string sDir, mu::value_type dPct=0.5) const
int getLines(StringView sTable, bool _bFull=false) const
bool isEmpty(const std::string &sTable) const
std::vector< mu::value_type > cnt(const std::string &sTable, std::string sDir) const
std::vector< mu::value_type > num(const std::string &sTable, std::string sDir) const
std::string getHeadLineElement(int _i, const std::string &_sTable) const
std::vector< mu::value_type > max(const std::string &sTable, std::string sDir) const
bool isValid() const
Evaluates, whether there's at least a single non-empty table.
std::vector< mu::value_type > std(const std::string &sTable, std::string sDir) const
void writeToTable(int _nLine, int _nCol, const std::string &_sCache, const mu::value_type &_dData)
bool setHeadLineElement(int _i, const std::string &_sTable, std::string _sHead)
int getCols(StringView sTable, bool _bFull=false) const
std::string getDataFileName(const std::string &sTable) const
This member function will return the file name of the selected table. Will default to the table name.
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
MemoryManager & getMemoryManager()
static void print(const std::string &__sLine, bool printingEnabled=true)
This member function appends the passed string as a new output line to the buffer and informs the ter...
static void toggleTableStatus()
Toggles the table writing status, which will reduce the number or events send to the terminal.
void format(std::string **_sMatrix, long long int _nCol, long long int _nLine, const Settings &_option, bool bDontAsk=false, int nHeadLineCount=1)
void setPrefix(std::string _sPrefix)
void setPluginName(std::string _sPluginName)
void setStatus(bool bStatus)
void setCompact(bool _bCompact)
void setCommentLine(std::string _sCommentLine)
void setFileName(std::string sFile)
This class manages the setting values of the internal (kernel) settings of this application.
size_t getPrecision() const
Returns the precision for displaying floating numbers in the terminal. This value determines the numb...
Common exception class for all exceptions thrown in NumeRe.
static size_t invalid_position
size_t size() const
This member function returns the size of the indices stored in this class.
std::string toSystemCodePage(std::string)
Converts an internal to an external string. Does nothing currently.
std::complex< double > intPower(const std::complex< double > &, int)
This function calculates the power of a value with the specialization that the exponent is an integer...
CONSTCD14 To round(const std::chrono::duration< Rep, Period > &d)
std::vector< double > real(const std::vector< value_type > &vVec)
string evaluateTargetOptionInCommand(string &sCmd, const string &sDefaultTarget, Indices &_idx, Parser &_parser, MemoryManager &_data, const Settings &_option)
This function evaluates the "target=TABLE()" expression and creates the target table,...
static void createStatsFile(Output &_out, const std::vector< std::vector< double > > &vStats, const std::string &sSavePath, MemoryManager &_data, const std::string &sTable, const Settings &_option)
This static function will create the output file using the functionalities of the Output class.
static void createStatsOutput(Output &_out, const std::vector< std::vector< double > > &vStats, const std::string &sSavePath, MemoryManager &_data, const std::string &sTable, const Settings &_option)
This static function creates the output table for the terminal. The table will get formatted using th...
static std::vector< std::vector< double > > calcStats(MemoryManager &_data, const std::string &sTable)
This static function calculates the statistical values for all columns in the passed table and return...
std::string plugin_statistics(std::string &sCmd, MemoryManager &_data)
This is the implementation of the stats command.
static std::string getStatFieldName(int nStatField)
This static function maps the statistical value enumerators to strings used for the tables and the re...
StatsFields
This enumeration defines the available statistical values in the vector returned from calcStats().
int findParameter(const std::string &sCmd, const std::string &sParam, const char cFollowing)
This function searches the passed parameter in the passed command string. If something is found,...
This structure is central for managing the indices of a table or cluster read or write data access....
std::string toString(int)
Converts an integer to a string without the Settings bloat.
double student_t(int nFreedoms, double dConfidenceInterval)
Calculate the student_t value for the selected degrees of freedoms and the desired confidence interva...