Search Results

Search found 9 results on 1 pages for 'xtable'.

Page 1/1 | 1 

  • R: including model specifications in xtable(anova(...))

    - by HamiltonUlmer
    Hello R comrades: I have a bunch of loglinear models, which, for our purposes will just be glm() objects called mx, my, mz. I want to get a nicely-formatted xtable of the analysis of deviance, so naturally I would want to perform xtable(anova(mx, my, mz, test = "Chisq")). The vanilla output of xtable, however, doesn't include the model specifications. I'd like to include those for all the ANOVA tests I'm running, so if there is not a param I'm missing that does this I'll probably just have to hack up my own solution. But looking over the help page, there doesn't seem to be an easy way to include the model specifications. Any thoughts? Alternatives? If it helps this was done in 2.9.1 with xtable 1.5-5.

    Read the article

  • How to put a newline into a column header in an xtable in R

    - by PaulHurleyuk
    I have a dataframe that I am putting into a sweave document using xtable, however one of my column names is quite long, and I would like to break it over two lines to save space calqc_table<-structure(list(RUNID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ANALYTEINDEX = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = structure(1:11, .Label = c("Cal A", "Cal B", "Cal C", "Cal D", "Cal E", "Cal F", "Cal G", "Cal H", "Cal High", "Cal Low", "Cal Mid"), class = "factor"), mean_conc = c(200.619459644855, 158.264703128903, 102.469121407733, 50.3551544728544, 9.88296440865076, 4.41727762501703, 2.53494715706024, 1.00602831741361, 199.065054555735, 2.48063347296935, 50.1499780776199), sd_conc = c(2.3275711264554, NA, NA, NA, NA, NA, NA, 0.101636943231162, 0, 0, 0), nrow = c(3, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2)), .Names = c("Identifier of the Run within the Study", "ANALYTEINDEX", "ID", "mean_conc", "sd_conc", "nrow"), row.names = c(NA, -11L ), class = "data.frame") calqc_xtable<-xtable(calqc_table) I have tried putting a newline into the name, but this didn't seem to work names(calqc_table)[1]<-"Identifier of the \nRun within the Study" Is there a way to do this ? I have seen someone suggest using the latex function from the hmisc package to manually iterate over the table and write it out in latex manually, including the newline, but this seems like a bit of a faf !

    Read the article

  • How to remove "Standard Error" column from xtable() output of an lm on R/RSweave/LaTeX

    - by Lucas Spangher
    I'm currently doing some data analysis on population data, so reporting the standard errors in the tables of parameter coefficients just doesn't really make statistical sense. I've done a fair bit of searching and can't find any way to customize the xtable output to remove it. Can anyone point me in the right direction? Thanks a lot, I didn't post this lightly; if it's something obvious, I apologize for having wasted time!

    Read the article

  • R data.frame with stacked specified titles for latex output with xtable

    - by hhh
    > w<-data.frame(c(0,0,1,1.3,2.1), c(0,0.6,0.9,1.6091,1.6299), c(258,141,206.4,125.8,140.5), c(162,162.7,162.4,162,162)) > colnames(w) <- c('Worst Cum', 'Best Cum', 'Worst Points', 'Best Points' ) Wrong (the code) Worst Cum Best Cum Worst Points Best Points 1 0.0 0.0000 258.0 162.0 2 0.0 0.6000 141.0 162.7 3 1.0 0.9000 206.4 162.4 4 1.3 1.6091 125.8 162.0 5 2.1 1.6299 140.5 162.0 Goal: how? CUM Points Worst Best Worst Best 1 0.0 0.0000 258.0 162.0 2 0.0 0.6000 141.0 162.7 3 1.0 0.9000 206.4 162.4 4 1.3 1.6091 125.8 162.0 5 2.1 1.6299 140.5 162.0 Trial 1: fail with many data.frames > a<-data.frame(c(0,0,1,1.3,2.1), c(0,0.6,0.9,1.6091,1.6299)) > b<-data.frame(c(258,141,206.4,125.8,140.5), c(162,162.7,162.4,162,162)) > c<-data.frame(cbind(a,b)) > colnames(c) <- c('Cum', 'Points') > colnames(a) <- c('Worst', 'Best') > colnames(b) <- c('Worst', 'Best') and > xtable(c) % latex table generated in R 2.13.1 by xtable 1.6-0 package % Thu Nov 24 03:43:34 2011 \begin{table}[ht] \begin{center} \begin{tabular}{rrrrr} \hline & Cum & Points & NA & NA \\ \hline 1 & 0.00 & 0.00 & 258.00 & 162.00 \\ 2 & 0.00 & 0.60 & 141.00 & 162.70 \\ 3 & 1.00 & 0.90 & 206.40 & 162.40 \\ 4 & 1.30 & 1.61 & 125.80 & 162.00 \\ 5 & 2.10 & 1.63 & 140.50 & 162.00 \\ \hline \end{tabular} \end{center} \end{table} > xtable(a) % latex table generated in R 2.13.1 by xtable 1.6-0 package % Thu Nov 24 03:45:06 2011 \begin{table}[ht] \begin{center} \begin{tabular}{rrr} \hline & Worst & Best \\ \hline 1 & 0.00 & 0.00 \\ 2 & 0.00 & 0.60 \\ 3 & 1.00 & 0.90 \\ 4 & 1.30 & 1.61 \\ 5 & 2.10 & 1.63 \\ \hline \end{tabular} \end{center} \end{table} It is wrong because it replaces the inner headers with higher-level header nb "NA" vals.

    Read the article

  • using gsub to modify output of xtable command

    - by stevejb
    Hello, my.mat <- cbind(1:5, rnorm(5), 6:10, rnorm(5)) colnames(my.mat) <- c("Turn", "Draw","Turn", "Draw") print(xtable(my.mat)) yields \begin{table}[ht] \begin{center} \begin{tabular}{rrrrr} \hline & Turn & Draw & Turn & Draw \\ \hline 1 & 1.00 & -0.72 & 6.00 & 0.91 \\ 2 & 2.00 & 0.57 & 7.00 & 0.56 \\ 3 & 3.00 & 1.08 & 8.00 & 0.55 \\ 4 & 4.00 & 0.95 & 9.00 & 0.46 \\ 5 & 5.00 & 1.94 & 10.00 & 1.06 \\ \hline \end{tabular} \end{center} \end{table} I want to filter out the \begin{table} and \end{table} lines. I can do this using gsub, but how to I get the results of print(xtable(... into a variable? Thanks for the help Stack Overflow R community!

    Read the article

  • How to include multiple tables programmaticaly into a Sweave document using R

    - by PaulHurleyuk
    Hello, I want to have a sweave document that will include a variable number of tables in. I thought the example below would work, but it doesn't. I want to loop over the list foo and print each element as it's own table. % \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{longtable} \usepackage{geometry} \usepackage{Sweave} \geometry{left=1.25in, right=1.25in, top=1in, bottom=1in} \listfiles \begin{document} <<label=start, echo=FALSE, include=FALSE>>= startt<-proc.time()[3] library(RODBC) library(psych) library(xtable) library(plyr) library(ggplot2) options(width=80) #Produce some example data, here I'm creating some dummy dataframes and putting them in a list foo<-list() foo[[1]]<-data.frame(GRP=c(rep("AA",10), rep("Aa",10), rep("aa",10)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[2]]<-data.frame(GRP=c(rep("BB",10), rep("bB",10), rep("BB",10)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[3]]<-data.frame(GRP=c(rep("CC",12), rep("cc",18)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[4]]<-data.frame(GRP=c(rep("DD",10), rep("Dd",10), rep("dd",10)), X1=rnorm(30), X2=rnorm(30,5,2)) @ \title{Docuemnt to test putting a variable number of tables into a sweave Document} \author{"Paul Hurley"} \maketitle \section{Text} This document was created on \today, with \Sexpr{print(version$version.string)} running on a \Sexpr{print(version$platform)} platform. It took approx \input{time} sec to process. <<label=test, echo=FALSE, results=tex>>= cat("Foo") @ that was a test, so is this <<label=table1test, echo=FALSE, results=tex>>= print(xtable(foo[[1]])) @ \newpage \subsection{Tables} <<label=Tables, echo=FALSE, results=tex>>= for(i in seq(foo)){ cat("\n") cat(paste("Table_",i,sep="")) cat("\n") print(xtable(foo[[i]])) cat("\n") } #cat("<<label=endofTables>>= ") @ <<label=bye, include=FALSE, echo=FALSE>>= endt<-proc.time()[3] elapsedtime<-as.numeric(endt-startt) @ <<label=elapsed, include=FALSE, echo=FALSE>>= fileConn<-file("time.tex", "wt") writeLines(as.character(elapsedtime), fileConn) close(fileConn) @ \end{document} Here, the table1test chunk works as expected, and produced a table based on the dataframe in foo[[1]], however the loop only produces Table(underscore)1.... Any ideas what I'm doing wrong ?

    Read the article

  • Best way to use PL/SQL Pacakge Cursors from Pro*C

    - by Greg Reynolds
    I have a cursor defined in PL/SQL, and I am wondering what the best way to use it from Pro*C is. Normally for a cursor defined in Pro*C you would do: EXEC SQL DECLARE curs CURSOR FOR SELECT 1 FROM DUAL; EXEC SQL OPEN curs; EXEC SQL FETCH curs INTO :foo; EXEC SQL CLOSE cusr; I was hoping that the same (or similar) syntax would work for a packaged cursor. For example, I have a package MyPack, with a declaration type MyType is record (X integer); cursor MyCurs(x in integer) return MyType; Now I have in my Pro*C code a rather unsatisfying piece of embedded PL/SQL that opens the cursor, does the fetching etc., as I couldn't get the first style of syntax to work. Using the example EXEC SQL EXECUTE DECLARE XTable is table of MyPack.MyType; BEGIN OPEN MyPack.MyCurs(:param); FETCH MyPack.MyCurs INTO XTable; CLOSE MyPack.MyCurs; END; END-EXEC; Does anyone know if there is a more "Pure" Pro*C approach?

    Read the article

  • Where to place the R code for R+Sweave+LaTeX workflow

    - by claytontstanley
    I spent the last week learning 3 new tools: R, Sweave, and LaTeX. One question that came to my mind though when working through my first project: Where do I place the majority of the R code? The tutorials that I read online placed the majority of the R code in the LaTeX .Rnw file. However, I find having a bunch of R calculations in the LaTeX file distracting. What I do find extremely helpful (of course) is to call out to R code in the LaTeX file and embed the result. So the workflow I've been using is to place 99% of my R code in my .R file. I run that file first, save a bunch of calculations as objects, and output the .Rout file once finished (to save the work). Then when running Sweave, I load up that .Rout file, so that I have the majority of my calculations already completed and in the Sweave R session. Then my LaTeX callouts to R are quite simple: Just give me the XTable stored in 'res.table', or give me the result of an already-computed calculation stored in the variable 'res'. So I push towards the minimal amount of R code in the LaTex file possible, to achieve the desired result (embedding stats results in the LaTeX writeup). Does anyone have any experience with this approach? I'm just worried I might run into trouble further down the line, when I start really trying to load up and leverage this workflow.

    Read the article

  • Suggestion for R/LaTeX table creation package

    - by aL3xa
    I've been using xtable package for a long time, and looking forward to writting my first package in R... so I reckon that if I have some "cool" idea that's worth carying out, there's a great chance that somebody got there before me... =) I'm interested in functions/packages specialized for LaTeX table creation (through R, of course). I bumped on quantreg package which has latex.table function. Any suggestion for similar function(s)/package(s)? P.S. I'm thinking about building a webapp in which users can define their own presets/templates of tables, choose style, statistics, etc. It's an early thought, though... =)

    Read the article

1