README

The Dataframe Object

Dataframe

#Usage

Dataframe my_dataframe

#Description

Dataframe objects supporting reading csv, with custom separator, storing columns in differents type vectors, creating a new Dataframe object on top of an already existing one specifying the rows and columns to copy, the same goes for a matrix (as std::vector<std::vector<T>>) and std::vector<T>. See examples.

#Arguments

NameDefinition
See_below See below

#Example(s)

See below


Dataframe.readf

#Usage

void readf(std::string &file_name, char delim = ',', bool header_name = 1, char str_context_begin = '\'', char str_context_end = '\'')

#Description

Import a csv as a Dataframe object.

#Arguments

NameDefinition
file_name is the file_name of the csv to read
delim is the column delimiter
header_name is if the first row is in fact the column names
str_context_begin is the first symbol of a quote, (to not take in count a comma as a new column if it is in a quote for example)
str_context_end is the end symbol for a quote context

#Example(s)

Dataframe obj1;
std::string file_name = "teste_dataframe.csv";
obj1.readf(file_name);


Dataframe.writef

#Usage

void writef(std::string &file_name, char delim = ',', bool header_name = 1, char str_context_bgn = '\'', char str_context_end = '\'')

#Description

Write a dataframe object into a csv file.

#Arguments

NameDefinition
file_name is the file name to write data into
delim is the column delimiter
header_name 1 to write the column names, 0 else
str_context_begin is the first symbol of a quote, (to not take in count a comma as a new column if it is in a quote for example)
str_context_end is the end symbol for a quote context

#Example(s)

// after reading teste_dataframe.csv as obj1
std::string out_file = "out.csv";
obj1.writef(out_file);


Dataframe.display

#Usage

void display();

#Description

Print the current dataframe.

#Arguments

NameDefinition
no no

#Example(s)

// after reading teste_dataframe.csv as obj1
obj1.display();
<uint> <uint> <uint> <str> <int> <char>
col1 col2 col3 col4 col5 col6
:0: 1 2 3 aa 5 z
:1: 6 7 8 bb 10 e
:2: 1 2 3 cc 5 h
:3: 6 7 8 uu 10 a
:4: 1 2 3 s4 -5 q
:5: 6 7 8 s9 10 p
:6: 1 2 3 a4 5 j
:7: 6 7 8 m9 10 i
:8: 6 7 8 s9 10 p
:9: 1 2 3 a4 5 j
:10: 6 7 8 m9 10 i
:11: 6 7 8 m9 10 i
:12: 6 7 8 s9 10 p
:13: 1 2 3 a4 5 j
:14: 6 7 8 m9 10 i



Dataframe.idx_dataframe

#Usage

void idx_dataframe(std::vector<int> &rows, std::vector<int> &cols, Dataframe &cur_obj)

#Description

Allow to copy a dataframe choosing rows and columns (by index) of the copied dataframe.

#Arguments

NameDefinition
rows is the vector containing all the rows to copy ({-1}) for all
cols is the vector of the index of the columns to copy
cur_obj is the dataframe that will contain all the rows and columns of the copied dataframe

#Example(s)

// after reading teste_dataframe.csv as obj1
Dataframe obj2;
std::vector<int> idx_rows = {-1};
std::vector<int> idx_cols2 = {1, 2, 3};
obj2.idx_dataframe(idx_rows, idx_cols2, obj1);

obj2.display();
col1 col2 col3
:0: 2 3 aa
:1: 7 8 bb
:2: 2 3 cc
:3: 7 8 uu
:4: 2 3 s4
:5: 7 8 s9
:6: 2 3 a4
:7: 7 8 m9
:8: 7 8 s9
:9: 2 3 a4
:10: 7 8 m9
:11: 7 8 m9
:12: 7 8 s9
:13: 2 3 a4
:14: 7 8 m9


Dataframe.name_dataframe

#Usage

void name_dataframe(std::vector<int> &rows, std::vector<int> &name_cols, Dataframe &cur_obj)

#Description

Allow to copy a dataframe choosing rows and columns (by name) of the copied dataframe.

#Arguments

NameDefinition
rows is the vector containing all the rows to copy ({-1}) for all
cols is the vector of the name of the columns to copy
cur_obj is the dataframe that will contain all the rows and columns of the copied dataframe

#Example(s)

// after reading teste_dataframe.csv as obj1
Dataframe obj2;
std::vector<int> idx_rows = {-1};
std::vector<std::string> idx_cols2 = {"col2", "col3", "col3"};
obj2.name_dataframe(idx_rows, idx_cols2, obj1);

obj2.display();
col1 col2 col3
:0: 2 3 aa
:1: 7 8 bb
:2: 2 3 cc
:3: 7 8 uu
:4: 2 3 s4
:5: 7 8 s9
:6: 2 3 a4
:7: 7 8 m9
:8: 7 8 s9
:9: 2 3 a4
:10: 7 8 m9
:11: 7 8 m9
:12: 7 8 s9
:13: 2 3 a4
:14: 7 8 m9


Dataframe.idx_colint

#Usage

template <typename T> void idx_colint(std::vector<int> rows, unsigned int x, std::vector<T> &rtn_v)

#Description

Allow to copy a int, unsigned int , bool or double column as a vector<T>, by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the index of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<int> currows = {1, 0, 1};
std::vector<unsigned int> outv = {};
obj1.idx_colint(currows, 2, outv);
print_nvec(outv);
:0: 8 3 8


Dataframe.name_colint

#Usage

template <typename T> void name_colint(std::vector<int> rows, std::string colname, std::vector<T> &rtn_v)

#Description

Allow to copy a int, unsigned int , bool or double column as a vector<T>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the name of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<int> currows = {1, 0, 1};
std::vector<unsigned int> outv = {};
obj1.idx_colint(currows, "col2", outv);
print_nvec(outv);
:0: 8 3 8


Dataframe.idx_colstr

#Usage

void idx_colstr(std::vector<int> rows, unsigned int x, std::vector<std::string> &rtn_v)

#Description

Allow to copy a std::string column as a vector<std::string>, by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the index of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> outv2 = {};
obj1.idx_colstr(currows, 3, outv2);
print_svec(outv2);
:0: bb aa bb


Dataframe.name_colstr

#Usage

template <typename T> void name_colint(std::vector<int> rows, std::string colname, std::vector<T> &rtn_v)

#Description

Allow to copy a int, unsigned int , bool or double column as a vector<std::string>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the name of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> outv2 = {};
obj1.name_colstr(currows, "col4", outv2);
print_svec(outv2);
:0: bb aa bb


Dataframe.idx_colchr

#Usage

void idx_colchr(std::vector<int> rows, unsigned int x, std::vector<char> &rtn_v)

#Description

Allow to copy a char column as a vector<char>, by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the index of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<char> outv3 = {};
obj1.idx_colchr(currows, 5, outv3);
for (char i : outv3) {
std::cout << i << " ";
};
std::cout << "\n";
e z e


Dataframe.name_colchr

#Usage

void name_colchr(std::vector<int> rows, std::string colname, std::vector<char> &rtn_v)

#Description

Allow to copy a char column as a vector<char>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x is the name of the column to copy
rtn_v is the vector that will contain the column to copy

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<char> outv3 = {};
obj1.name_colchr(currows, "col6", outv3);
for (char i : outv3) {
std::cout << i << " ";
};
std::cout << "\n";
e z e


Dataframe.idx_matrint

#Usage

template <typename T> void idx_matrint(std::vector<int> rows, std::vector<unsigned int> x_v, std::vector<std::vector<T>> &rtn_matr)

#Description

Allow to copy a set of columns that are same type (int, unsigned int, bool or double) as a std::vector<std::vector<T>> , by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ( {-1} ) for all
x_v is the vector containing the indices of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::vector<unsigned int>> out_matr = {};
std::vector<unsigned int> idx_cols = {1, 0, 2, 2};
obj1.idx_matrint(currows, idx_cols, out_matr);
print_nmatr(out_matr);
[0] [1] [2] [3]
:0: 7 6 8 8
:1: 2 1 3 3
:2: 7 6 8 8


Dataframe.name_matrint

#Usage

template <typename T> void name_matrint(std::vector<int> rows, std::vector<std::string> x_v, std::vector<std::vector<T>> &rtn_matr)

#Description

Allow to copy a set of columns that are same type (int, unsigned int, bool or double) as a std::vector<std::vector<T>>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x_v is the vector containing the names of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::vector<unsigned int>> out_matr = {};
std::vector<std::string> idx_vec2 = {"col1", "col2", "col3"};
obj1.name_matrint(currows, idx_vec2, out_matr);
print_nmatr(out_matr);
[0] [1] [2]
:0: 6 7 8
:1: 1 2 3
:2: 6 7 8


Dataframe.idx_matrstr

#Usage

void idx_matrstr(std::vector<int> rows, std::vector<unsigned int> x_v, std::vector<std::vector<std::string>> &rtn_matr)

#Description

Allow to copy a set of columns that are std::string type as a std::vector<std::vector<std::string>>, by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x_v is the vector containing the indices of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::vector<std::string>> out_matr2 = {};
std::vector<unsigned int> idx_cols = {3};
obj1.idx_matrstr(currows, idx_cols, out_matr2);
print_smatr(out_matr2);
[0]
:0: bb
:1: aa
:2: bb


Dataframe.name_matrstr

#Usage

void name_matrstr(std::vector<int> rows, std::vector<std::string> x_v, std::vector<std::vector<std::string>> &rtn_matr)

#Description

Allow to copy a set of columns that are std::string type as a std::vector<std::vector<std::string>>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x_v is the vector containing the names of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::vector<std::string>> out_matr2 = {};
std::vector<std::string> idx_vec2 = {"col4"};
obj1.name_matrstr(currows, idx_vec2, out_matr2);
print_smatr(out_matr2);
[0]
:0: bb
:1: aa
:2: bb


Dataframe.idx_matrchr

#Usage

void idx_matrchr(std::vector<int> rows, std::vector<unsigned int> x_v, std::vector<std::vector<char>> &rtn_matr)

#Description

Allow to copy a set of columns that are char type as a std::vector<std::vector<char>>, by column index.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x_v is the vector containing the indices of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::vector<char>> out_matr3 = {};
std::vector<unsigned int> idx_cols = {5};
obj1.idx_matrchr(currows, idx_cols, out_matr3);
print_smatr(out_matr3);
[0]
:0: e
:1: z
:2: e


Dataframe.name_matrchr

#Usage

void name_matrchr(std::vector<int> rows, std::vector<std::string> x_v, std::vector<std::vector<char>> &rtn_matr)

#Description

Allow to copy a set of columns that are char type as a std::vector<std::vector<char>>, by column name.

#Arguments

NameDefinition
rows is a vector containing the row indices to copy ({-1}) for all
x_v is the vector containing the names of the column to copy
rtn_matr is the matrix that will contain all the columns copyed

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<char> out_matr3 = {};
std::vector<std::string> idx_vec2 = {"col6"};
obj1.name_matrchr(currows, idx_vec2, out_matr3);
print_smatr(out_matr3);
[0]
:0: e
:1: z
:2: e


Dataframe.get_nrow

#Usage

unsigned int get_nrow();

#Description

Returns the number of rows for the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
unsigned int nrow = obj1.get_nrow();
15


Dataframe.get_ncol

#Usage

unsigned int get_ncol();

Returns the number of columns for the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
unsigned int ncol = obj1.get_ncol();
6


Dataframe.get_rowname

#Usage

std::vector<std::string> get_rowname();

Returns the rowname of the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> row_names = obj1.get_rowname();
nothing becuase obj1 has no rownames


Dataframe.get_colname

#Usage

std::vector<std::string> get_colname();

Returns the colname of the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> col_names = obj1.get_colname();
col1 col2 col3 col4 col5 col6


Dataframe.set_rowname

#Usage

void set_rowname(std::vector<std::string> &x);

Set rowname to the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> row_names = {"n1", "n2", "n3"..."n15"};
obj1.set_rowname(row_names);


Dataframe.set_colname

#Usage

void set_colname(std::vector<std::string> &x);

Set colname to the associated dataframe.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<std::string> col_names = {"col1", "col2", "col3", "col4",
"col5", "col6"};
obj1.set_colname();


Dataframe.replace_colint

#Usage

template <typename T> void replace_colint(std::vector<T> &x, unsigned int &colnb)

Replace a int, unsigned int, bool or double column of the associated dataframe.

#Arguments

NameDefinition
x is the column (as vector) that will replace the dataframe column
colnb is the index of the column to replace

#Example(s)

// after reading teste_dataframe.csv as obj1

std::vector<unsigned int> rpl_col = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14};
unsigned int col = 0;
obj1.replace_colint(rpl_col, col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char>
col1 col2 col3 col4 col5 col6
:0: 0 2 3 aa 5 z
:1: 1 7 8 bb 10 e
:2: 2 2 3 cc 5 h
:3: 3 7 8 uu 10 a
:4: 4 2 3 s4 -5 q
:5: 5 7 8 s9 10 p
:6: 6 2 3 a4 5 j
:7: 7 7 8 m9 10 i
:8: 8 7 8 s9 10 p
:9: 9 2 3 a4 5 j
:10: 10 7 8 m9 10 i
:11: 11 7 8 m9 10 i
:12: 12 7 8 s9 10 p
:13: 13 2 3 NA 5 j
:14: 14 7 8 m9 10 i


Dataframe.replace_colstr

#Usage

void replace_colstr(std::vector<std::string> &x, unsigned int &colnb)

#Description

Replace a string column of the associated dataframe.

#Arguments

NameDefinition
x is the column (as vector) that will replace the dataframe column
colnb is the index of the column to replace

#Example(s)

// after reading teste_dataframe.csv as obj1

std::vector<std::string> rpl_col = {"0", "1", "2", "3", "4", "5", "6",
"7", "8", "9",
"10", "11", "12", "13", "14"};
unsigned int col = 3;
obj1.replace_colstr(rpl_col, col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char>
col1 col2 col3 col4 col5 col6
:0: 1 2 3 0 5 z
:1: 6 7 8 1 10 e
:2: 1 2 3 2 5 h
:3: 6 7 8 3 10 a
:4: 1 2 3 4 -5 q
:5: 6 7 8 5 10 p
:6: 1 2 3 6 5 j
:7: 6 7 8 7 10 i
:8: 6 7 8 8 10 p
:9: 1 2 3 9 5 j
:10: 6 7 8 10 10 i
:11: 6 7 8 11 10 i
:12: 6 7 8 12 10 p
:13: 1 2 3 13 5 j
:14: 6 7 8 14 10 i


Dataframe.replace_colchr

#Usage

void replace_colchr(std::vector<char> &x, unsigned int &colnb)

#Description

Replace a string column of the associated dataframe.

#Arguments

NameDefinition
x is the column (as vector) that will replace the dataframe column
colnb is the index of the column to replace

#Example(s)

// after reading teste_dataframe.csv as obj1

std::vector<char> rpl_col = {'c', 'c', 'c', 'c', 'c', 'c', 'c',
'c', 'c', 'c',
'b', 'b', 'v', 'v', 'v'};
unsigned int col = 5;
obj1.replace_colchr(rpl_col, col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char>
col1 col2 col3 col4 col5 col6
:0: 1 2 3 aa 5 c
:1: 6 7 8 bb 10 c
:2: 1 2 3 cc 5 c
:3: 6 7 8 uu 10 c
:4: 1 2 3 s4 -5 c
:5: 6 7 8 s9 10 c
:6: 1 2 3 a4 5 c
:7: 6 7 8 m9 10 c
:8: 6 7 8 s9 10 c
:9: 1 2 3 a4 5 c
:10: 6 7 8 m9 10 b
:11: 6 7 8 m9 10 b
:12: 6 7 8 s9 10 v
:13: 1 2 3 NA 5 v
:14: 6 7 8 m9 10 v


Dataframe.add_colint

#Usage

template <typename T> void add_colint(std::vector<T> &x, std::string name = "NA")

#Description

Add a column int, unsigned int, bool or double type to the associated dataframe

#Arguments

NameDefinition
x is the column to add
name is the column to add name

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<unsigned int> rpl_col = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14};
obj1.add_colint(rpl_col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char> <uint>
col1 col2 col3 col4 col5 col6 NA
:0: 1 2 3 aa 5 z 0
:1: 6 7 8 bb 10 e 1
:2: 1 2 3 cc 5 h 2
:3: 6 7 8 uu 10 a 3
:4: 1 2 3 s4 -5 q 4
:5: 6 7 8 s9 10 p 5
:6: 1 2 3 a4 5 j 6
:7: 6 7 8 m9 10 i 7
:8: 6 7 8 s9 10 p 8
:9: 1 2 3 a4 5 j 9
:10: 6 7 8 m9 10 i 10
:11: 6 7 8 m9 10 i 11
:12: 6 7 8 s9 10 p 12
:13: 1 2 3 NA 5 j 13
:14: 6 7 8 m9 10 i 14


Dataframe.add_colstr

#Usage

void add_colstr(std::vector<std::string> &x, std::string name = "NA")

#Description

Add a column string type to the associated dataframe.

#Arguments

NameDefinition
x is the column to add
name is the column to add name

#Example(s)

// after reading teste_dataframe.csv as obj1

std::vector<std::string> rpl_col = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14"};
obj1.add_colstr(rpl_col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char> <str>
col1 col2 col3 col4 col5 col6 NA
:0: 1 2 3 aa 5 z 0
:1: 6 7 8 bb 10 e 1
:2: 1 2 3 cc 5 h 2
:3: 6 7 8 uu 10 a 3
:4: 1 2 3 s4 -5 q 4
:5: 6 7 8 s9 10 p 5
:6: 1 2 3 a4 5 j 6
:7: 6 7 8 m9 10 i 7
:8: 6 7 8 s9 10 p 8
:9: 1 2 3 a4 5 j 9
:10: 6 7 8 m9 10 i 10
:11: 6 7 8 m9 10 i 11
:12: 6 7 8 s9 10 p 12
:13: 1 2 3 NA 5 j 13
:14: 6 7 8 m9 10 i 14


Dataframe.add_colchr

#Usage

add_colchr(std::vector<char> &x, std::string name = "NA")

#Description

Add a column char type to the associated dataframe.

#Arguments

NameDefinition
x is the column to add
name is the column to add name

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<char> rpl_col = {'c', 'c', 'c', 'c', 'c', 'c', 'c',
'c', 'c', 'c',
'b', 'b', 'v', 'v', 'v'};
obj1.add_colchr(rpl_col);
obj1.display();
<uint> <uint> <uint> <str> <int> <char> <char>
col1 col2 col3 col4 col5 col6 NA
:0: 1 2 3 aa 5 z c
:1: 6 7 8 bb 10 e c
:2: 1 2 3 cc 5 h c
:3: 6 7 8 uu 10 a c
:4: 1 2 3 s4 -5 q c
:5: 6 7 8 s9 10 p c
:6: 1 2 3 a4 5 j c
:7: 6 7 8 m9 10 i c
:8: 6 7 8 s9 10 p c
:9: 1 2 3 a4 5 j c
:10: 6 7 8 m9 10 i b
:11: 6 7 8 m9 10 i b
:12: 6 7 8 s9 10 p v
:13: 1 2 3 NA 5 j v
:14: 6 7 8 m9 10 i v


Dataframe.rm_col

#Usage

void rm_col(std::vector<unsigned int> &nbcolv)

#Description

Removes columns from associated dataframe.

#Arguments

NameDefinition
nbcolv is a vector containing all the indices of the columns to erase from the associated dataframe. The indices must be sorted descendly.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<unsigned int> colv = {4, 1};
obj1.rm_col(colv);
obj1.display();
<uint> <uint> <str> <char>
col1 col3 col4 col6
:0: 1 3 aa z
:1: 6 8 bb e
:2: 1 3 cc h
:3: 6 8 uu a
:4: 1 3 s4 q
:5: 6 8 s9 p
:6: 1 3 a4 j
:7: 6 8 m9 i
:8: 6 8 s9 p
:9: 1 3 a4 j
:10: 6 8 m9 i
:11: 6 8 m9 i
:12: 6 8 s9 p
:13: 1 3 NA j
:14: 6 8 m9 i


Dataframe.rm_row

#Usage

void rm_col(std::vector<unsigned int> &nbcolv)

#Description

Removes rows from associated dataframe.

#Arguments

NameDefinition
nbcolv is a vector containing all the indices of the rows to erase from the associated dataframe. The indices must be sorted descendly.

#Example(s)

// after reading teste_dataframe.csv as obj1
std::vector<unsigned int> rowv = {4, 1};
obj1.rm_row(rowv);
obj1.display();
<uint> <uint> <uint> <str> <int> <char>
col1 col2 col3 col4 col5 col6
:0: 1 2 3 aa 5 z
:1: 1 2 3 cc 5 h
:2: 6 7 8 uu 10 a
:3: 6 7 8 s9 10 p
:4: 1 2 3 a4 5 j
:5: 6 7 8 m9 10 i
:6: 6 7 8 s9 10 p
:7: 1 2 3 a4 5 j
:8: 6 7 8 m9 10 i
:9: 6 7 8 m9 10 i
:10: 6 7 8 s9 10 p
:11: 1 2 3 NA 5 j
:12: 6 7 8 m9 10 i


Dataframe.transform_inner

#Usage

void transform_inner(Dataframe &cur_obj, unsigned int &in_col, unsigned int &ext_col)

#Description

Applies a inner join on the associated dataframe.

#Arguments

NameDefinition
cur_obj is the other dataframe used for inner join
in_col is the index of the column representing the key (primary) of the associated dataframe
ext_col is the index of the column representing the key (foreign) of the other dataframe used for the inner join

#Example(s)


Dataframe obj1, obj2;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj1.transform_inner(obj2, col1, col2);
obj1.display();
<str> <uint>
col1 col2
:0: id1 1
:1: id2 6
:2: id4 6
:3: id5 1
:4: id6 6
:5: id7 1
:6: id8 6
:7: id9 6
:8: id11 6
:9: id12 6
:10: id14 1
:11: id15 6


Dataframe.transform_excluding

#Usage

void transform_excluding(Dataframe &cur_obj, unsigned int &in_col, unsigned int &ext_col)

#Description

Applies a excluding join on the associated dataframe.

#Arguments

NameDefinition
cur_obj is the other dataframe used for the excluding join
in_col is the index of the column representing the key (primary) of the associated dataframe
ext_col is the index of the column representing the key (foreign) of the other dataframe used for the excluding join

#Example(s)


Dataframe obj1, obj2;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj1.transform_excluding(obj2, col1, col2);
obj1.display();
<str> <uint>
col1 col2
:0: id3 1
:1: id10 1
:2: id13 6


Dataframe.merge_inner

#Usage

void merge_inner(Dataframe &obj1, Dataframe &obj2, bool colname, unsigned int &key1, unsigned int &key2)

#Description

Performs a inner join on a newly created dataframe.

#Arguments

NameDefinition
obj1 is the first dataframe
obj2 is the second dataframe
colname 1 to give the column names to the newly created dataframe
key1 is the index of the first dataframe column as primary key
key1 is the index of the first dataframe column as foreign key

#Example(s)


Dataframe obj1, obj2, obj3;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj3.merge_inner(obj1, obj2, 1, col1, col2);
obj3.display();
<str> <uint> <str> <uint> <uint>

:0: id1 1 id1 2 3
:1: id2 6 id2 7 8
:2: id4 6 id4 7 8
:3: id5 1 id5 2 3
:4: id6 6 id6 7 8
:5: id7 1 id7 2 3
:6: id8 6 id8 2 3
:7: id9 6 id9 7 8
:8: id11 6 id11 7 8
:9: id12 6 id12 7 8
:10: id14 1 id14 7 8
:11: id15 6 id15 2 3


Dataframe.merge_excluding

#Usage

void merge_excluding(Dataframe &obj1, Dataframe &obj2, bool colname, unsigned int &key1, unsigned int &key2)

#Description

Performs a left excluding join to the associated dataframe (newly created). The first dataframe as argument is considered as the left one.

#Arguments

NameDefinition
obj1 is the left dataframe
obj2 is the right dataframe
colname 1 to give the column names to the newly created dataframe
key1 is the index of the column of the left dataframe
key2 is the index of the column of the right dataframe

#Example(s)

Dataframe obj1, obj2, obj3;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj3.merge_excluding(obj1, obj2, 1, col1, col2);
obj3.display();
<str> <uint> <str> <uint> <uint>

:0: id3 1 NA NA NA
:1: id10 1 NA NA NA
:2: id13 6 NA NA NA


Dataframe.merge_excluding_both

#Usage

void merge_excluding_both(Dataframe &obj1, Dataframe &obj2, bool colname, unsigned int &key1, unsigned int &key2)

#Description

Performs a full excluding join to the associated dataframe (newly created). The first dataframe as argument is considered as the left one.

#Arguments

NameDefinition
obj1 is the left dataframe
obj2 is the right dataframe
colname 1 to give the column names to the newly created dataframe
key1 is the index of the column of the left dataframe
key2 is the index of the column of the right dataframe

#Example(s)

Dataframe obj1, obj2, obj3;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj3.merge_excluding_both(obj1, obj2, 1, col1, col2);
obj3.display();
<str> <uint> <str> <uint> <uint>

:0: id3 1 NA NA NA
:1: id10 1 NA NA NA
:2: id13 6 NA NA NA
:3: NA NA id119 7 8


Dataframe.merge_all

#Usage

void merge_all(Dataframe &obj1, Dataframe &obj2, bool colname, unsigned int &key1, unsigned int &key2)

#Description

Performs a full join to the associated dataframe (newly created). The first dataframe as argument is considered as the left one.

#Arguments

NameDefinition
obj1 is the left dataframe
obj2 is the right dataframe
colname 1 to give the column names to the newly created dataframe
key1 is the index of the column of the left dataframe
key2 is the index of the column of the right dataframe

#Example(s)

Dataframe obj1, obj2, obj3;
std::string filename = "outb.csv";
obj1.readf(filename);

std::vector<unsigned int> colv = {4, 3, 2};
obj1.rm_col(colv);

std::string f2 = "outb2.csv";
obj2.readf(f2);

unsigned int col1 = 0;
unsigned int col2 = 0;

obj3.merge_all(obj1, obj2, 1, col1, col2);
obj3.display();
<str> <uint> <str> <uint> <uint>

:0: id3 1 NA NA NA
:1: id10 1 NA NA NA
:2: id13 6 NA NA NA
:3: NA NA id119 7 8
:4: id1 1 id1 2 3
:5: id2 6 id2 7 8
:6: id4 6 id4 7 8
:7: id5 1 id5 2 3
:8: id6 6 id6 7 8
:9: id7 1 id7 2 3
:10: id8 6 id8 2 3
:11: id9 6 id9 7 8
:12: id11 6 id11 7 8
:13: id12 6 id12 7 8
:14: id14 1 id14 7 8
:15: id15 6 id15 2 3