
We need to adapt them to the R syntax for numbers. The example is a Spanish report that uses thousands and decimal separators in the value matrix. There are two columns and two rows of labels. When we only have the cells of the pivot table, we define the number of rows and columns containing labels using define_labels(n_col = 2, n_row = 2). We delete the first row using remove_top(1) because it does not contain labels. The cells between the rows and columns of labels can be ignored. The pivot table only contains labels and values, therefore rows or columns with other information have to be removed. We define that the value that identifies it (the pivot table page) is in cell (r1, c1), by means of set_page(1, 1). It is common to find null values in that matrix because the data is not produced or recorded for the combination of labels that define it. Each value of this matrix is characterized by the combination of labels of the corresponding row and column. The matrix of values is made up of rows and columns after those containing labels (rows from r4 on, and columns from c3 on). Let us suppose that the content of the cell (r1, c1) is especially relevant because it serves to identify the content of this pivot table with respect to others. The header is made up of row r1 and the intersection between rows and columns of labels (cells of c1 and c2 with r2 and r3). In the table above, columns c1 and c2 contain labels, also rows r2 and r3. It can contain additional information, such as table header or footer. Finally, the document ends with the conclusions section.Ī pivot table contains label rows and columns, and an array of values, usually numeric data. In addition, transformations that can be carried out on a flat table are presented: they are not supported by package flattabler but are alternative or complementary to those of the package, so they are shown here. Then, the operations available in flattabler package, classified according to their purpose, are presented. The rest of this document is structured as follows: First, an illustrative example of transforming a pivot table into a flat table is presented.
#FLAT TABLE TOOL MANUAL#
But, if we get data in pivot table format and need to represent or analyse it using another tool, this package can be very helpful: It can save us several hours of programming or manual transformation.įlattabler package offers a set of operations that allow us to transform one or more pivot tables into a flat table.



If we generate pivot tables from our own data, flattabler package is not necessary. They are generated from spreadsheets and, more recently, also from R ( pivottabler). Pivot tables are generally used to present raw and summary data.
