How can we get the source of R Documentation for an existing function (the contents of the *.Rd
), say plot
or lubridate::ymd
. Something for documentations that is similar to fix
for functions?
tools::Rd_db
creates a named list of parsed .Rd files for an installed package. For instance, to print the contents of lubridate's .Rd file ymd.Rd
, you could use:
## 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 ...