有沒有一種簡單的方法可以在交互式環境中查看R包(或包中的方法)的來源?查看R包的來源
Q
查看R包的來源
22
A
回答
18
只要輸入功能/方法的名稱不帶括號:
R> base::rev.default
function (x)
if (length(x)) x[length(x):1L] else x
<environment: namespace:base>
也R-服務檯見 - 訪問來源在R News Volume 6/4, October 2006。
9
要找出你想看到哪些方法,寫methods(funcOfInterest)
有時不足以print(funcOfInterest.class)
。然後嘗試print(getAnywhere(funcOfInterest.class))
。
15
您如何找到源代碼取決於函數的類型。請參閱my answer以解決此相關問題。
正如rcs指出的那樣,如果你想指定一個包,你可以使用::
。
> lattice::xyplot
function (x, data, ...)
UseMethod("xyplot")
<environment: namespace:lattice>
並非包中的所有函數都將被導出(即公開提供);對於這些你需要使用:::
。
> lattice::xyplot.formula
Error: 'xyplot.formula' is not an exported object from 'namespace:lattice'
> lattice:::xyplot.formula
function (x, data = NULL, allow.multiple = is.null(groups) ||
outer, outer = !is.null(groups), auto.key = FALSE, aspect = "fill",
panel = lattice.getOption("panel.xyplot"), prepanel = NULL,
scales = list(), strip = TRUE, groups = NULL, xlab, xlim,
ylab, ylim, drop.unused.levels = lattice.getOption("drop.unused.levels"),
..., lattice.options = NULL, default.scales = list(), subscripts = !is.null(groups),
subset = TRUE)
{
formula <- x
dots <- list(...)
# etc.
相關問題
- 1. 如何查看R的源代碼
- 2. HtmlUnit來查看源代碼
- 3. 查看內置emacs包的源代碼
- 4. 如何查看HTTP請求的來源?
- 5. jQuery查看創建元素的來源
- 6. 如何查看錶單的來源
- 7. 查看一個內建[R包
- 8. 查看R
- 9. JaCoCo報告看起來正確,但無法查看來源
- 10. 查看源代碼來自PhoneGap/Cordova web查看
- 11. 設置的iFrame來源爲「查看源代碼:{URL}」不工作
- 12. 如何查看R .Internal或.Primitive函數的源代碼?
- 13. 如何查看R的源代碼(預解析)
- 14. 如何查看使用R的網頁源代碼?
- 15. 如何在R中查看NMF算法的源代碼?
- 16. 如何查看r中包中的數據集的內容?
- 17. Sweave,包括來源的R函數文件
- 18. 如何查看R中包的所有方法,對象,dataframse等?
- 19. Asp.net數據源 - 查看數據源對象查看SQL數據?
- 20. 查看來自R中巨大CSV文件的評論
- 21. R:查看本地變量
- 22. curl沒有顯示正確的來源,通過瀏覽器查看頁面源查看
- 23. 來自python源的rpm包
- 24. 如何查看顯示HTML的在線.py文件的來源?
- 25. 查看IntelliJ中使用的Java類的來源想法
- 26. Laravel5包裝查看
- 27. 如何查看包含的JavaScript源代碼?
- 28. 如何查看Eclipse中包的源代碼?
- 29. 問題標記,而不是查看資源包的Unicode字符
- 30. R - rjson「意外字符::」(查找錯誤的來源)
並注意,如果您正在交互式工作,則不需要顯式調用'print'。 – Dason 2012-11-02 20:00:30