I want to show the contents of data.frame as a table in slidify. I know how to create Markdown tables from data.frames using the ascii library, but when I try to use it with slidify, instead of seeing the table in the output html, I see a bunch of information about the internal structure of the ascii table.
So how do you type, for example. head (some.data.frame) in slidify?
Edit:
Actually I want to show the table of representations in the CRAN task view. Right now I typed the table manually in Markdown:
Views | Content --------|-------- Bayesian| Bayesian Inference ChemPhys| Chemometrics and Computational Physics ClinicalTrials| Clinical Trial Design, Monitoring, and Analysis
I want to create this table automatically from the ctv
package. I collected all the necessary information in the data.frame file:
library(ctv) list.of.views <- available.views() X <- data.frame(View=NA,Description=NA) for(i in 1:length(list.of.views)) { X[i,1] <- list.of.views[[i]]$name X[i,2] <- list.of.views[[i]]$topic } head(X)
that leads to
View Description 1 Bayesian Bayesian Inference 2 ChemPhys Chemometrics and Computational Physics 3 ClinicalTrials Clinical Trial Design, Monitoring, and Analysis 4 Cluster Cluster Analysis & Finite Mixture Models 5 DifferentialEquations Differential Equations 6 Distributions Probability Distributions
I'm doing markdown with ascii
package
library(ascii) print(ascii(X[1:6,1:2]), type = 'pandoc')
which shows this in terminal R:
**View** **Description** --- ----------------------- ------------------------------------------------- 1 Bayesian Bayesian Inference 2 ChemPhys Chemometrics and Computational Physics 3 ClinicalTrials Clinical Trial Design, Monitoring, and Analysis 4 Cluster Cluster Analysis & Finite Mixture Models 5 DifferentialEquations Differential Equations 6 Distributions Probability Distributions --- ----------------------- ------------------------------------------------- Warning messages: 1: In rep(rownames, length = nrow(x)) : 'x' is NULL so the result will be NULL 2: In rep(colnames, length = ncol(x)) : 'x' is NULL so the result will be NULL
but when this last line is print
in the code block in my Rmd
and slidify
, I see the following contents on my slide:
## <S4 Type Object> ## attr(,".xData") ## <environment: 0x03b904d8> ## attr(,"class") ## [1] "asciiTable" ## attr(,"class")attr(,"package") ## [1] "ascii"