lizzieinvancouver / decsens

0 stars 0 forks source link

help with formatting tables #17

Closed lizzieinvancouver closed 4 years ago

lizzieinvancouver commented 4 years ago

@cchambe12 @dbuona @AileneKane @MoralesCastilla Andrew wrote, "The rotated text on the tables is giving me a headache! There's enuf room to format these in the usual way. Just use multiple lines for the header if necessary." I tried to fix this adding 'align' to the tables, but xtable seems to ignore it. If you have any ideas I would appreciate help!

Here's the code now:

print(xtable(mean2spp.forpaper10yr, caption = "caption text cut", label="tab:pep10yr", digits=c(0,0, 1, 1, 1, 1, 1, 1, 1, 2), sanitize.rownames.function = italic), include.rownames=FALSE, size="\\small", caption.placement="top", rotate.colnames = TRUE, sanitize.text.function = identity)

Here's what I tried: print(xtable(mean2spp.forpaper10yr, caption = "caption text cut", label="tab:pep10yr", digits=c(0,0, 1, 1, 1, 1, 1, 1, 1, 2), sanitize.rownames.function = italic), include.rownames=FALSE, size="\\small", caption.placement="top", rotate.colnames = TRUE, sanitize.text.function = identity, align=c('l', 'p{1.5in}', rep('c',8)) align=c("p{0.1\\textwidth}|", "p{0.2\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|"))

AileneKane commented 4 years ago

@lizzieinvancouver I fiddled with it a little bit. If you add a space in the tcolumn names, it will automatically line break where the space is. So, try:

colnames(mean2spp.forpaper10yr)[4]<-"mean(ST. leafout)"
print(xtable(mean2spp.forpaper10yr, caption = "Climate and phenology statistics for two species (\\emph{Betula pendula, Fagus sylvatica}, across 45 and 47 sites respectively) from the PEP725 data across all sites with continuous data from 1950-1960 and 2000-2010. ST is spring temperature from March 1 to April 30, ST.leafout is temperature 30 days before leafout, and GDD is growing degree days 30 days before leafout. Slope represents the estimated sensitivity using untransformed leafout and ST, while log-slope represents the estimated sensitivity using log(leafout) and log(ST). We calculated all metrics for for each species  x site x 10 year period before taking mean or variance estimates. See also Fig. \\ref{fig:pepper10yr}.", label="tab:pep10yr", align=c("p{0.02\\textwidth}|","|p{0.1\\textwidth}|", "p{0.15\\textwidth}|", "p{0.09\\textwidth}|", "p{0.12\\textwidth}|", "p{0.08\\textwidth}|", "p{0.1\\textwidth}|", "p{0.1\\textwidth}|", "p{0.08\\textwidth}|", "p{0.08\\textwidth}|"), digits=c(0,0, 1, 1, 1, 1, 1, 1, 1, 2), sanitize.rownames.function = italic), include.rownames=FALSE, size="\\footnotesize", caption.placement="top", sanitize.text.function = identity)
AileneKane commented 4 years ago

I also think that making the tables footnote sized would help

lizzieinvancouver commented 4 years ago

@AileneKane Thank you! This worked great. I think the tables look much better. I will close this now.