I'm including in an RMarkdown
document factor analysis results from the psych
package. The factor loading table is printed using fa2latex()
, in the psychTools
package. The R code looks like this:
facm <- fa(corrmat, n.factors = 3, rotate = "varimax", fm = "wls")
fa2latex(facm, font.size = "small", caption = "Mandatory Measure Factor Analysis", heading = "Factor Loadings")
The code chunk options are echo = FALSE, results = "asis"
This produces LaTeX code that looks in part like this:
% Called in the psych package fa2latex % Called in the psych package facm % Called in the psych package small % Called in the psych package Factor Loadings % Called in the psych package Mandatory Measure Factor Analysis
\begin{table}[htpb]\caption{Mandatory Measure Factor Analysis}
...
The pdf file resulting from this looks like this:
% Called in the psych package fa2latex % Called in the psych package facm % Called in the psych package small % Called in the psych package Factor Loadings % Called in the psych package Mandatory Measure Factor Analysis Table 1: Mandatory Measure Factor Analysis
I don't want to mess with the code in the psychTools
package, but I don't want the comments to print. Any ideas on how to effect this?
Set silent = TRUE
and then pass it to cat()
.
```{r echo = FALSE, results = 'asis'}
cat(fa2latex(facm,
font.size = "small",
caption = "Mandatory Measure Factor Analysis",
heading = "Factor Loadings",
silent = TRUE))
```
Example