2. Создание проекта R package вместе с Unit tests и documentation.

Creating R project with Unit tests and documentation.
1-3 help:
1. Install R
--
2. Install RStudio
3. Install Rtools
---------------------------------------------------------------------- 4. Create new project File -- New Project -- New Directory -- R Package myRTestPrj 5. install.packages("devtools") 6. hello стрелка влево- function(a) { print(paste0("Hello, ", a, ", this is the world!")) } Code -стрелка вправо Insert Roxygen Sceleton #' Title #' #' @param a input name #' #' @return phrase #' @export #' #' @examples #' hello("John") 7. delete NAMESPACE and hello.Rd 8. install.packages("xfun") devtools::document() ?hello 9. usethis::use_mit_license() 10. usethis::use_testthat() 11. usethis::use_test("hello") test_that("multiplication works", { expect_equal(hello("J"), "Hello, J, this is the world!") }) 12. devtools::test() 13. install.packages("covr") covr::report() 14. devtools::check() 15. hello("df") 16. usethis::use_readme_rmd() 17. devtools::build_readme() 18. install.packages("forcats") usethis::use_package("forcats") in hello.R forcats:: 19. devtools::install() 20. remove.packages("myRTestPrj") 21. restart Session 22. hello("df") devtools::load_all() hello("df")

Смотрите также