<div dir="ltr">Hi,<div><br></div><div style>I have a data.table with list and float columns. I want to print it with the floats rounded to display only a few significant digits. Using getAnywhere(print.data.table), I see that digits is an option. However, when I use it, it seems to have no effect. Is there a special way to pass arguments to hidden functions like this (on the methods(print) list it shows up as print.data.table*)?</div>
<div style><br></div><div style>Anyway, here are the first two lines of my dt:</div><div style><br></div><div style><div><font face="courier new, monospace">DT <- structure(list(fisyr = 1995:1996, er = list(c(1, 3), c(1, 3)), </font></div>
<div><font face="courier new, monospace"> eg = c(0.0197315833926059, 0.0197315833926059), esal = list(</font></div><div><font face="courier new, monospace"> c(2329.89763779528, 2423.6811023622), c(2263.07456978967, </font></div>
<div><font face="courier new, monospace"> 2354.16826003824)), fr = list(c(4, 4), c(4, 4)), fg = c(0.039310363070415, </font></div><div><font face="courier new, monospace"> 0.039310363070415), fsal = list(c(2520.85433070866, 2520.85433070866</font></div>
<div><font face="courier new, monospace"> ), c(2448.55449330784, 2448.55449330784)), mr = list(c(5, </font></div><div><font face="courier new, monospace"> 30), c(5, 30)), mg = c(0.0197779376457164, 0.0197779376457164</font></div>
<div><font face="courier new, monospace"> ), msal = list(c(2571.70078740157, 4215.73622047244), c(2497.94263862333, </font></div><div><font face="courier new, monospace"> 4094.82600382409))), .Names = c("fisyr", "er", "eg", "esal", </font></div>
<div><font face="courier new, monospace">"fr", "fg", "fsal", "mr", "mg", "msal"), class = c("data.table", </font></div><div><font face="courier new, monospace">"data.frame"), row.names = c(NA, -2L))</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">print(DT,digits=4)</font></div><div style><font face="courier new, monospace"># just DT</font></div><div><font face="courier new, monospace">print.data.frame(DT,digits=4)</font></div>
<font face="courier new, monospace"># fisyr er eg esal fr fg fsal mr mg msal<br># 1 1995 1, 3 0.01973 2330, 2424 4, 4 0.03931 2521, 2521 5, 30 0.01978 2572, 4216<br># 2 1996 1, 3 0.01973 2263, 2354 4, 4 0.03931 2449, 2449 5, 30 0.01978 2498, 4095</font><div style>
<br></div><div style>Printing as a data.frame does the rounding/shortening, but the list columns look ugly (thanks to that extra space), so I'd rather see a data.table output.</div><div style><br></div><div style>It's a tiny data.table, so if anyone knows a fancy lapply trick for this, that'd be cool. I'm going to try to find one myself now.</div>
<div style><br></div><div style>Thanks,</div><div style><br></div><div style>Frank</div></div></div>