my function and comment is:
#' @examples check_duplication(iris,col_names = "Sepal.Length",check_type = F)
# check_duplication(iris,col_names = "Sepal.Width")
check_duplication <- function(data,col_names,check_type=T){
if(check_type){ data <- as.data.frame(data)}
duplicate_nums<- nrow(data)-nrow(as.data.frame(base::unique(data[,col_names])))
return(duplicate_nums)
}
it works will on testthat
test and console
when i used devtools::check(),
it reports error
i know when i use F instead False ,this error would'd happan, but what cause this matter?
checking examples ... ERROR
Running examples in ‘datools-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: check_duplication
> ### Title: check data unique
> ### Aliases: check_duplication
>
> ### ** Examples
>
> check_duplication(iris,col_names = "Sepal.Length",check_type = F)
Error in check_duplication(iris, col_names = "Sepal.Length", check_type = F) :
F used instead of FALSE
Execution halted
i have two question :
- how to solve this error
- what's difference between TRUE and F in R
thanks for your help ~