2013-01-18 16 views
7
> dput(head(t)) 
structure(list(Team = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Union", class = "factor"), 
    Date = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("2012-01-06", 
    "2012-02-06", "2012-03-06", "2012-04-06", "2012-05-06", "2012-07-06", 
    "2012-09-06", "2012-10-06", "2012-11-06", "2012-12-06"), class = "factor"), 
    STime = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "07:03", class = "factor"), 
    ETime = structure(c(6L, 7L, 8L, 5L, 5L, 1L), .Label = c("01:13", 
    "03:13", "06:13", "09:13", "10:13", "11:13", "12:13", "13:13", 
    "15:13", "16:13", "18:13"), class = "factor")), .Names = c("Team", 
"Date", "STime", "ETime"), row.names = c(NA, 6L), class = "data.frame") 

मैं knitr में तालिका प्रारूप में इस डेटा फ्रेम t डाल करने के लिए या तो ज्योतिषी या xtable उपयोग करने में सक्षम होना चाहते हैं में ज्योतिषी या xable तालिका सम्मिलित। मैं knitr के लिए नया हूँ, मैं ग्राफ बना सकते हैं, आदि, लेकिन सफलतापूर्वक knitr दस्तावेज़ में टेबल रखने में असमर्थ हूँ।knitr दस्तावेज़

मेरे test.rnw फ़ाइल अब तक इस तरह दिखता है:

\documentclass[11pt]{article} 
\begin{document} 

<<setup, echo = FALSE, results= 'hide', message = FALSE>>= 
data(mtcars) 

library(ggplot2) 
qplot(speed, dist, data = cars) + geom_smooth() 
@ 

\end{document} 

मैं कैसे t डेटा फ्रेम की सामग्री प्रदर्शित करने के लिए इस दस्तावेज़ में एक ज्योतिषी तालिका सम्मिलित हैं?

उत्तर

12

क्या आपका मतलब कुछ ऐसा है (परिणाम = 'asis')?

\documentclass[11pt]{article} 
\begin{document} 

<<setup, echo = FALSE, results= 'hide', message = FALSE>>= 
data(mtcars) 

library(ggplot2) 
qplot(speed, dist, data = cars) + geom_smooth() 
@ 


<<results='asis'>>= 
require(stargazer) 
stargazer(mtcars, summary = FALSE) 
@ 

\end{document} 
संबंधित मुद्दे