r - Horizontal xtable on summary of data from read.csv -


i've got csv file looks this:

rtt,from,req,bytes,ttl 202,10.0.0.10,1,64,64 191,10.0.0.10,2,64,64 ... 

i trying produce latex summary() using library(xtable), so:

library(xtable) pings <- read.csv("pings.csv") s <- summary(pings$rtt) xtable(t(s)) 

this produces output:

\begin{table}[ht] \centering \begin{tabular}{rrrrrrr}   \hline  & min. & 1st qu. & median & mean & 3rd qu. & max. \\   \hline 1 & 40.70 & 42.70 & 43.40 & 44.90 & 44.10 & 202.00 \\    \hline \end{tabular} \end{table} 

this almost want, except first column containing empty value , 1.

clearly, i'm missing vital, basic knowledge data types , conversions in r. problem of course t(s) produces:

      min. 1st qu. median  mean 3rd qu.  max. [1,]  40.7    42.7   43.4  44.9    44.1 202.0 

wherein [,1] should explain xtable's output.

can please point out me i'm doing wrong?

if i'm trying run xtable on summary, get

> xtable(summary(pings$rtt)) error in xtable.table(summary(pings$rtt)) :    xtable.table not implemented tables of > 2 dimensions 

this handled print.xtable():

> library(xtable) > print.xtable(xtable(t(summary(runif(10)))), include.rownames=false) % latex table generated in r 3.0.2 xtable 1.7-3 package % sat apr 26 20:03:32 2014 \begin{table}[ht] \centering \begin{tabular}{rrrrrr}   \hline min. & 1st qu. & median & mean & 3rd qu. & max. \\    \hline 0.03 & 0.18 & 0.48 & 0.41 & 0.61 & 0.74 \\     \hline \end{tabular} \end{table} 

here include.rownames=false disables outputting row names. see ?print.xtable more details.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -