Testing R Code (Chapman & Hall/CRC The R Series)
暫譯: 測試 R 代碼 (Chapman & Hall/CRC R 系列)
Richard Cotton
- 出版商: Chapman and Hall/CRC
- 出版日期: 2017-01-19
- 售價: $2,490
- 貴賓價: 9.5 折 $2,366
- 語言: 英文
- 頁數: 196
- 裝訂: Hardcover
- ISBN: 1498763650
- ISBN-13: 9781498763653
-
相關分類:
R 語言
海外代購書籍(需單獨結帳)
商品描述
Learn how to write R code with fewer bugs.
The problem with programming is that you are always one typo away from writing something silly. Likewise with data analysis, a small mistake in your model can lead to a big mistake in your results. Combining the two disciplines means that it is all too easy for a missed minus sign to generate a false prediction that you don’t spot until it’s too late. Testing is the only way to be sure that your code, and your results, are correct.
Testing R Code teaches you how to perform development-time testing using the testthat package, allowing you to ensure that your code works as intended. The book also teaches run-time testing using the assertive package; enabling your users to correctly run your code.
After beginning with an introduction to testing in R, the book explores more advanced cases such as integrating tests into R packages; testing code that accesses databases; testing C++ code with Rcpp; and testing graphics. Each topic is explained with real-world examples, and has accompanying exercises for readers to practise their skills ― only a small amount of experience with R is needed to get started!
商品描述(中文翻譯)
學習如何撰寫更少錯誤的 R 代碼。
程式設計的問題在於,你總是距離一個打錯字的錯誤只有一步之遙。同樣地,在數據分析中,模型中的小錯誤可能會導致結果中的重大錯誤。將這兩個學科結合在一起,意味著錯過一個負號很容易產生一個你直到太遲才發現的錯誤預測。測試是確保你的代碼和結果正確的唯一方法。
測試 R 代碼 教你如何使用 testthat 套件進行開發時測試,讓你能夠確保你的代碼按預期運作。這本書還教你如何使用 assertive 套件進行執行時測試,使你的用戶能夠正確運行你的代碼。
在開始介紹 R 中的測試後,這本書探討了更高級的案例,例如將測試整合到 R 套件中;測試訪問數據庫的代碼;使用 Rcpp 測試 C++ 代碼;以及測試圖形。每個主題都用真實世界的例子進行解釋,並附有練習題讓讀者練習技能 ― 只需少量的 R 經驗即可開始!