एक और (और निचला कुंजी) विकल्प जो आप देख सकते हैं comment()
और attr()
फ़ंक्शन आपके कार्यों में कुछ मेटा डेटा जोड़ने के लिए हैं।
FOO <- function(x,y) {
x + y
}
attr(FOO, "comment") <- "FOO performs simple addition"
#This can be arbitrary. "comment" is special. see ?comment for details.
attr(FOO, "help") <- "FOO expects two numbers, and it will add them together"
फिर आप attributes()
का उपयोग करके FOO
के साथ जुड़े सब कुछ देख सकते हैं::
> attributes(FOO)
$source
[1] "function(x,y) {" " x + y " "}"
$comment
[1] "FOO performs simple addition"
$help
[1] "FOO expects two numbers, and it will add them together"
या विशिष्ट भागों निकालें:
> attr(FOO, "help")
[1] "FOO expects two numbers, and it will add them together"
attr(FOO, "comment")
[1] "FOO performs simple addition"
और के मामले में यहां एक त्वरित और मूर्खतापूर्ण उदाहरण है टिप्पणी, comment()
का उपयोग करें:
> comment(FOO)
[1] "FOO performs simple addition"
लंबी अवधि में, अपना खुद का पैकेज लिखना लगभग निश्चित रूप से ओवरहेड और समय निवेश के लायक होगा, लेकिन अगर किसी कारण से यह अल्प अवधि में व्यावहारिक नहीं है - यहां एक और विकल्प है।
क्या यह एक roxygen गूंज है? गूंज? – Chase