I want to print the results of two functions with Rmarkdown. These functions operate under certain conditions. If the conditions are not satisfied, the function returns NULL, but I don't want NULL to be written in the output of Rmarkdown. Can you help with this?
The sample code is given below.
title: "Untitled"
author: "Biostat44"
date: "19 Nisan 2019"
output: word_document
This will only print the result of the second if. Rmarkdown will print everything that results of a chunk. You need to get a result in adequation with the printing part afterward. If results is NULL, it will print NULL, unless you deal with something like if is NULL then print nothing ("" or like here nothing as no result at all)
Also, for this kind of question, do not hesitate to ask on https://community.rstudio.com instead of Github Issue. There is a large community ready to help there and Github issue are more suited for issues with the 📦 or feature request.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
I want to print the results of two functions with Rmarkdown. These functions operate under certain conditions. If the conditions are not satisfied, the function returns NULL, but I don't want NULL to be written in the output of Rmarkdown. Can you help with this?
The sample code is given below.
title: "Untitled"
author: "Biostat44"
date: "19 Nisan 2019"
output: word_document
l=NROW(iris$Sepal.Length)
if(l<=50){
shapiro.test(x =iris$Sepal.Length )
}else{
return(NULL)
}
NULL
if(l>150){
ks.test(x = iris$Sepal.Length,"pnorm")
}else{
return(NULL)
}
Warning in ks.test(x = iris$Sepal.Length, "pnorm"): ties should not be
present for the Kolmogorov-Smirnov test
One-sample Kolmogorov-Smirnov test
data: iris$Sepal.Length
D = 0.99999, p-value < 2.2e-16
alternative hypothesis: two-sided
The text was updated successfully, but these errors were encountered: