update dsviewer
This commit is contained in:
parent
8e46c178be
commit
71068038e8
@ -525,6 +525,25 @@ void insert_data(const std::vector<std::string> &cmd_units)
|
||||
return;
|
||||
}
|
||||
|
||||
void set_data(const std::vector<std::string> &cmd_units)
|
||||
{
|
||||
// set row|col \<name\> \<value\>
|
||||
if (cmd_units.size() < 4) throw std::runtime_error("set: insufficient parameters.");
|
||||
|
||||
if (cmd_units[1] == "row")
|
||||
{
|
||||
_1s_array row_data(tc.row_number(), cmd_units[3]);
|
||||
tc.fill_row(row_data, cmd_units[2]);
|
||||
}
|
||||
else if (cmd_units[1] == "col")
|
||||
{
|
||||
_1s_array col_data(tc.col_number(), cmd_units[3]);
|
||||
tc.fill_column(col_data, cmd_units[2]);
|
||||
}
|
||||
else throw std::runtime_error("set: invalid parameters.");
|
||||
return;
|
||||
}
|
||||
|
||||
void display_table(const std::vector<std::string> &cmd_units)
|
||||
{
|
||||
// view
|
||||
|
@ -59,9 +59,10 @@ void math_func(const std::vector<std::string> &cmd_units);
|
||||
void rand_data(const std::vector<std::string> &cmd_units);
|
||||
void filt_data(const std::vector<std::string> &cmd_units);
|
||||
void insert_data(const std::vector<std::string> &cmd_units);
|
||||
void set_data(const std::vector<std::string> &cmd_units);
|
||||
void display_table(const std::vector<std::string> &cmd_units);
|
||||
|
||||
#define CMD_NUM 17
|
||||
#define CMD_NUM 18
|
||||
const cmd_pair commands[CMD_NUM] = {
|
||||
{"quit", quit, "Quit the program."},
|
||||
{"view", display_table, "Display valid cells."},
|
||||
@ -74,6 +75,7 @@ const cmd_pair commands[CMD_NUM] = {
|
||||
{"enable", set_enable, "Enable column/row outputs by name or index."},
|
||||
{"disable", set_disable, "Disable column/row outputs by name or index."},
|
||||
{"insert", insert_data, "Insert a new column/row data."},
|
||||
{"set", set_data, "Set a column/row data."},
|
||||
{"type", set_type, "Set column/row data types."},
|
||||
{"title", set_titles, "Set row and column titles."},
|
||||
{"math", math_func, "Preform mathematic operations of column data."},
|
||||
|
@ -17,19 +17,22 @@ Open a dsv/csv file. The default setups are 'nohead', space for delimeter, '#' f
|
||||
Save table to a dsv/csv file. The default setups are space for delimeter, '#' for annotations, and '!' for tags. If the file name ends with '.csv', the default delimeter is ','.
|
||||
|
||||
#### stats \<colname1\> \<colname2\> ...
|
||||
Show statistics of a data column or columns. If the input file has no column names, use inbuild names `C<id>` to select the columns.
|
||||
Show statistics of a data column or columns. If the input file has no column names, use inbuilt names `C<id>` to select the columns.
|
||||
|
||||
#### enable table|column|row [\<name1\> \<name2\> ...]
|
||||
Enable table outputs. If the input file has no row or column names, use inbuild names `R<id>` and `C<id>` to select the rows and columns.
|
||||
Enable table outputs. If the input file has no row or column names, use inbuilt names `R<id>` and `C<id>` to select the rows and columns.
|
||||
|
||||
#### disable table|column|row [\<name1\> \<name2\> ...]
|
||||
Disable table outputs. If the input file has no row or column names, use inbuild names `R<id>` and `C<id>` to select the rows and columns.
|
||||
Disable table outputs. If the input file has no row or column names, use inbuilt names `R<id>` and `C<id>` to select the rows and columns.
|
||||
|
||||
#### insert row|col [\<new-name\>] [\<insert-name\>]
|
||||
Insert a new row or column. The new row or column will be attached to the end of the table by default. A `new-name` can be provided if the user wants to rename the new row or column. Provide the `insert-name` to insert the new row or column at the specified row or column. The remaining columns or rows will be moved one step right or down accordingly. If the input file has no row or column names, use inbuild names `R<id>` and `C<id>` to select the rows and columns.
|
||||
Insert a new row or column. The new row or column will be attached to the end of the table by default. A `new-name` can be provided if the user wants to rename the new row or column. Provide the `insert-name` to insert the new row or column at the specified row or column. The remaining columns or rows will be moved one step right or down accordingly. If the input file has no row or column names, use inbuilt names `R<id>` and `C<id>` to select the rows and columns.
|
||||
|
||||
#### set row|col \<name\> \<value\>
|
||||
Set a row or column's value to the given one. If the input file has no row or column names, use inbuilt names `R<id>` and `C<id>` to select the rows and columns.
|
||||
|
||||
#### type row|col int|float|string \<name\>
|
||||
Set the data type of a row or column. If the input file has no row or column names, use inbuild names `R<id>` and `C<id>` to select the rows and columns.
|
||||
Set the data type of a row or column. If the input file has no row or column names, use inbuilt names `R<id>` and `C<id>` to select the rows and columns.
|
||||
|
||||
#### title row|col \<t1\>,\<t2\>,\<t3\>,... [\<id1\>,\<id2\>,\<id3\>,...]
|
||||
Set row and column titles. The titles will be assigned sequentially if no index is specified.
|
||||
|
Loading…
Reference in New Issue
Block a user