<commit_before>
import React from 'react';
import {generate_headers, PositionChecker} from '../lib/utils';

export default class MatrixTable extends React.Component {

    render() {
        let table = this.props.table;
        let column_heading = table.heading.map((heading, index) => {
            let header;
            let resp = [];
            let hopper = table.hopper[heading];

            hopper(true); // TODO: we reset since React Hot Loader regards hoppers as state to be preserverd

            for (var i=0; i < table.meta.heading_size; i++) {
                header = hopper();
                if (header) {
                    resp[resp.length] = <th colSpan={ table.meta.hops[heading] }>{header}</th>;
                }
            }
            return resp;
        });
        let data = table.matrix.map((row, index) => {
            //let span_headings = get_span_headings(index, table, checks);
            //
            //let low_heading = <th key={i}>{
            //    last_rowheader_gen.next().value
            //}</th>;


            return <tr key={index}>{
                [row.map((cell, cindex) => {
                        return <td key={index + '_' + cindex}>
                            {cell}
                        </td>})
                ]
            }</tr>
        });

        return <table>
            <thead>
            <tr>
                <th rowSpan={table.heading.length} colSpan={table.stub.length} />
                {column_heading[0]}
            </tr>
            {
                column_heading.slice(1).map((heading, index) => {
                    if (index==0) return heading;<commit_msg>Table building is visually confirmed to work for row headers as well<commit_after>
import React from 'react';
import {generate_headers, PositionChecker} from '../lib/utils';

export default class MatrixTable extends React.Component {

    render() {
        let table = this.props.table;

        // TODO: we reset since React Hot Loader regards hoppers as state to be preserved
        for (let key in table.hopper) table.hopper[key](true);

        let column_heading = table.heading.map((heading, index) => {
            let header;
            let resp = [];
            let hopper = table.hopper[heading];

            for (var i=0; i < table.meta.heading_size; i++) {
                header = hopper();
                if (header) {
                    resp[resp.length] = <th colSpan={ table.meta.hops[heading] }>{header}</th>;
                }
            }
            return resp;
        });

        let data = table.matrix.map((row, index) => {

            let row_heading = table.stub.map((heading, index) => {
                let header;
                let hopper = table.hopper[heading];

                header = hopper();
                if (header) {
                    return <th rowSpan={ table.meta.hops[heading] }>{header}</th>;
                } else {
                    return null;
                }
            });

            return <tr key={index}>{
                [
                    row_heading,
                    row.map((cell, cindex) => {
                        return <td key={index + '_' + cindex}>
                            {cell}
                        </td>})
                ]
            }</tr>
        });

        return <table>
            <thead>
            <tr>
                <th rowSpan={table.heading.length} colSpan={table.stub.length} />
                {column_heading[0]}
            </tr>
            {
                column_heading.slice(1).map((heading, index) => {
                    if (index==0) return heading;
{'fraction_non_alphanumeric': 0.12510288065843622, 'fraction_numerical': 0.0021947873799725653, 'mean_word_length': 1.2988650693568726, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3721577', 'n_tokens_mistral': 983, 'n_tokens_neox': 928, 'n_words': 236}