3

Here's a very simple task that I don't seem to be able to get the format right. In short, I am trying to import and format a long tab-delimited txt file, with the first row as the header. I tried the package pgfplotstable with the following codes. As an example, I trimmed the table to include only 2 rows (in addition to the header.) and 5 columns only. Any pointer wiLl be much appreciated ! The error message : Package PGF Math Error: Could not parse input 'AAA' as a floating point number.

\documentclass{article}
\usepackage{pgfplotstable}

\begin{document}

\section{test}

\begin{table}[h!]\centering
    \pgfplotstableset{
        every head row/.style={before row=\toprule,after row=\midrule},
        every last row/.style={after row=\bottomrule}
        }
    \pgfplotstabletypeset[
        col sep=tab, columns/info/.style={string type,column type=r},
        ] {../2.Co-occurrence/demo.txt}
    \caption{Test Data}
\end{table}

\end{document}

Here's what demo.txt looks like :

Gene1   Gene2   coef    P-val   RRR(test)
AAA BBB 0.44    2.67E-13    4.00E-12
CCC DDD 0.38    8.00E-10    3.12E-08

The desired table is included here.enter image description here

closed as unclear what you're asking by Moriambar, Troy, TeXnician, Stefan Pinnow, Stefan Kottwitz Jun 10 '17 at 12:39

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome! Presumably column type=r is responsible for the error? Does it work if you remove it? – cfr Aug 18 '15 at 23:08
  • 1
    Can you show your temp.txt contents? – user11232 Aug 18 '15 at 23:17
  • you have to add string type to Gene1 and Gene2 columns. – percusse Aug 19 '15 at 4:09
  • I just added what the imported file looks like. Removing column type=r does not help. I think I will need to specify string type for each column? I was hoping for a way to skip specifying each column. if all are treated as text. – Aron Aug 19 '15 at 22:42
  • 1
    Then you need to add string type as a standalone option to pgfplotstabletypeset without the columns/... stuff – percusse Aug 19 '15 at 22:53