Subsetting R objects can be very useful when writing reproducible reports.
m <- ttest$method
p <- round (ttest$p.value,3) #the round() function is used to round the p-value to 3 decimals
For example, it can be used to add text to plots
boxplot ( BMI ~ Walkability, data=BEPAS, xlab=NULL)
text(x=1.5, y=43,label=paste("P-value of",p," \n ",m)) # "\n" to start a next line