0

I can get help in R 3.1.2 on Yates function from FrF2 package through:

?FrF2::Yates

Now I want to get help in .tex format through helpExtract function unction which can be obtained from here (written by @AnandaMahto). I tried this code but not working:

helpExtract(FrF2:Yates, section = "Examples", type = "s_text")

I wonder if there is any way to mention the package name in helpExtract function?

halfer
  • 19,824
  • 17
  • 99
  • 186
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
  • 2
    If you use [`helpExtract`](https://github.com/mrdwab/SOfun/blob/master/R/helpExtract.R) from ["SOfun"](https://github.com/mrdwab/SOfun), you should be able to specify the package. – A5C1D2H2I1M1N2O1R2T1 Nov 17 '14 at 18:20
  • Cool--@AnandaMahto. This works like a charm in `R 3.1.2` but fails in `RStudio Version 0.98.1091` and throws the following error: `argument 'object' must deparse to a single character string`. The arguments of `helpExtract` in `RStudio Version 0.98.1091` are `function (Function, section = "Usage", type = "m_code")`. However R show the following arguments `function (Function, section = "Usage", type = "m_code", ...)`. Any thoughts. – MYaseen208 Nov 17 '14 at 18:51

1 Answers1

1

This will take a function name and return a package name:

 pkg <- function(fn) find( deparse(substitute(fn) )  )
 pkg(mean)
#[1] "package:base"

But I think it's going to have trouble with the ?pkg::func format so I pulled out everything before the last ":" with gsub:

pkg <- function(fn) find(gsub(".+[:]","", deparse(substitute(fn) ) ) )
pkg(base::mean)
[1] "package:base"
IRTFM
  • 258,963
  • 21
  • 364
  • 487