r语言 - 如何获取函数的相应 Rd 文档文件



我们如何获取现有函数的R文档(*.Rd的内容(的来源,例如plotlubridate::ymd。类似于函数fix

的文档?

tools::Rd_db创建一个已解析的命名列表。已安装软件包的 rd 文件。例如,打印润滑剂的内容。Rd 文件ymd.Rd,您可以使用:

## create list of parsed .Rd files
db <- tools::Rd_db("lubridate")
## names of .Rd files
names(db)
#>  [1] "DateCoercion.Rd"      "DateTimeUpdate.Rd"    "Deprecated.Rd"       
#>  [4] "Duration-class.Rd"    "Interval-class.Rd"    "Period-class.Rd"     
#>  [7] "Timespan-class.Rd"    "am.Rd"                "as.duration.Rd"      
#> [10] "as.interval.Rd"       "as.period.Rd"         "as_date.Rd"          
#> [13] "date.Rd"              "date_decimal.Rd"      "day.Rd"              
#> [16] "days_in_month.Rd"     "decimal_date.Rd"      "dst.Rd"              
#> [19] "duration.Rd"          "fit_to_timeline.Rd"   "force_tz.Rd"         
#> [22] "guess_formats.Rd"     "hidden_aliases.Rd"    "hms.Rd"              
#> [25] "hour.Rd"              "interval.Rd"          "is.Date.Rd"          
#> [28] "is.POSIXt.Rd"         "is.difftime.Rd"       "is.instant.Rd"       
#> [31] "is.timespan.Rd"       "lakers.Rd"            "leap_year.Rd"        
#> [34] "local_time.Rd"        "lubridate-package.Rd" "make_datetime.Rd"    
#> [37] "make_difftime.Rd"     "minute.Rd"            "month.Rd"            
#> [40] "mplus.Rd"             "now.Rd"               "origin.Rd"           
#> [43] "parse_date_time.Rd"   "period.Rd"            "period_to_seconds.Rd"
#> [46] "pretty_dates.Rd"      "quarter.Rd"           "reclass_date.Rd"     
#> [49] "reclass_timespan.Rd"  "rollback.Rd"          "round_date.Rd"       
#> [52] "second.Rd"            "stamp.Rd"             "time_length.Rd"      
#> [55] "timespan.Rd"          "today.Rd"             "tz.Rd"               
#> [58] "week.Rd"              "with_tz.Rd"           "within-interval.Rd"  
#> [61] "year.Rd"              "ymd.Rd"               "ymd_hms.Rd"
## print ymd.Rd
db[["ymd.Rd"]]
#> title{Parse dates with strong{y}ear, strong{m}onth, and strong{d}ay components}name{ymd}alias{ymd}alias{ydm}alias{mdy}alias{myd}alias{dmy}alias{dym}alias{yq}keyword{chron}description{
#> Transforms dates stored in character and numeric vectors to Date or POSIXct
#> objects (see code{tz} argument). These functions recognize arbitrary
#> non-digit separators as well as no separator. As long as the order of
#> formats is correct, these functions will parse dates correctly even when the
#> input vectors contain differently formatted dates. See examples.
#> }usage{
#> ymd(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> ydm(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> mdy(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> myd(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> dmy(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> dym(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"),
#>   truncated = 0)
#> 
#> yq(..., quiet = FALSE, tz = NULL, locale = Sys.getlocale("LC_TIME"))
#> }
#> ... ETCETERA ...

相关内容

  • 没有找到相关文章

最新更新