Hi,
The code below is a reproducible example (for me).
When I run the chunk in R (from RStudio) b1 is printed out as expected but when I knit it it says that b1 is NULL
title: "example"
author: "Alasdair Noble"
date: "21/05/2020"
output: word_document
editor_options:
chunk_output_type: console
library(lme4)
library(predictmeans)
mydat <- NULL
mydat$Grp <- c("A","A","A","B","B","B")
mydat$resp <- c(1,2,3,4,5,6)
mydat$exp <- as.factor(c(1,2,3,1,2,3))
mydat <- as.data.frame(mydat)
m1 <- lmer(resp ~ exp + (1|Grp), data=mydat)
sm1 <- summary(m1)
sm1
pm1 <- predictmeans(m1,"exp",pairwise=TRUE,adj="tukey", Df=3, plot=FALSE)
pm1
b <- lapply(pm1, attributes)
b1 <- b$"Pairwise p-value"$"Letter-based representation of pairwise comparisons at significant level ‘0.05’"
b1