Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed naming convention.

  • Loading branch information...
commit 43a521c5a9371f18e5c58ed2a775bc4e7652946c 1 parent e07a029
@Dasonk authored
View
8 DESCRIPTION
@@ -29,12 +29,12 @@ Collate:
'Description.R'
'Details.R'
'Examples.R'
- 'fdAssign.R'
- 'fdExample.R'
- 'fdGet.R'
- 'fdHelp.R'
'fdToRoxygen.R'
'argumentsCheck.R'
'nonNullDefault.R'
'Return.R'
'paste0.R'
+ 'flyassign.R'
+ 'flyexample.R'
+ 'flyget.R'
+ 'flyhelp.R'
View
4 NAMESPACE
@@ -10,6 +10,6 @@ export(Details)
export(Examples)
export(Return)
export(Title)
-export(fdExample)
-export(fdHelp)
+export(flyexample)
+export(flyhelp)
import(tools)
View
4 R/Arguments.R
@@ -6,7 +6,7 @@
#' @param fun A function
#' @export
Arguments <- function(fun){
- fdGet("Arguments", fun)
+ flyget("Arguments", fun)
}
#' Set the flydoc arguments documentation
@@ -19,5 +19,5 @@ Arguments <- function(fun){
#' argument documentation to add to the function's documentation
#' @export
"Arguments<-" <- function(func, value){
- invisible(fdAssign("Arguments", func, value))
+ invisible(flyassign("Arguments", func, value))
}
View
4 R/Description.R
@@ -6,7 +6,7 @@
#' @param fun A function
#' @export
Description <- function(fun){
- fdGet("Description", fun)
+ flyget("Description", fun)
}
#' Set a description
@@ -19,5 +19,5 @@ Description <- function(fun){
#' the description to add to the function's documentation
#' @export
"Description<-" <- function(func, value){
- invisible(fdAssign("Description", func, value))
+ invisible(flyassign("Description", func, value))
}
View
4 R/Details.R
@@ -6,7 +6,7 @@
#' @param fun A function
#' @export
Details <- function(fun){
- fdGet("Details", fun)
+ flyget("Details", fun)
}
#' Set a detail section
@@ -19,5 +19,5 @@ Details <- function(fun){
#' details section to add to the function's documentation
#' @export
"Details<-" <- function(func, value){
- invisible(fdAssign("Details", func, value))
+ invisible(flyassign("Details", func, value))
}
View
4 R/Examples.R
@@ -6,7 +6,7 @@
#' @param fun A function
#' @export
Examples <- function(fun){
- fdGet("Examples", fun)
+ flyget("Examples", fun)
}
#' Set some examples
@@ -19,5 +19,5 @@ Examples <- function(fun){
#' examples to add to the function's documentation
#' @export
"Examples<-" <- function(func, value){
- invisible(fdAssign("Examples", func, value))
+ invisible(flyassign("Examples", func, value))
}
View
4 R/Return.R
@@ -8,7 +8,7 @@
#' @aliases Value
#' @export
Return <- function(fun){
- fdGet("Return", fun)
+ flyget("Return", fun)
}
#' Set documentation for return
@@ -22,5 +22,5 @@ Return <- function(fun){
#' return to add to the function's documentation
#' @export
"Return<-" <- function(func, value){
- invisible(fdAssign("Return", func, value))
+ invisible(flyassign("Return", func, value))
}
View
4 R/Title.R
@@ -6,7 +6,7 @@
#' @param fun A function
#' @export
Title <- function(fun){
- fdGet("Title", fun)
+ flyget("Title", fun)
}
#' Set a title
@@ -19,6 +19,6 @@ Title <- function(fun){
#' title to add to the function's documentation
#' @export
"Title<-" <- function(func, value){
- invisible(fdAssign("Title", func, value))
+ invisible(flyassign("Title", func, value))
}
View
4 R/fdAssign.R → R/flyassign.R
@@ -1,5 +1,5 @@
-fdAssign <- function(name, fun, value){
- fun <- flydoc(fun)
+flyassign <- function(name, fun, value){
+ fun <- flycheck(fun)
assign(name, value, envir = attr(fun, "flydoc"))
return(fun)
}
View
2  R/flydoc.R
@@ -1,6 +1,6 @@
# Make sure there is a flydoc environment associated
# with the function. If not then add one.
-flydoc <- function(fun){
+flycheck <- function(fun){
if(is.null(attr(fun, "flydoc"))){
attr(fun, "flydoc") <- new.env(parent = emptyenv())
}
View
2  R/fdExample.R → R/flyexample.R
@@ -5,7 +5,7 @@
#'
#' @param fun The function that has flydoc documentation
#' @export
-fdExample <- function(fun){
+flyexample <- function(fun){
text <- Examples(fun)
source(textConnection(text), echo = TRUE)
}
View
2  R/fdGet.R → R/flyget.R
@@ -1,4 +1,4 @@
-fdGet <- function(value, fun){
+flyget <- function(value, fun){
tryCatch(get(value, envir = attr(fun, "flydoc")),
error = function(e){NULL})
}
View
4 R/fdHelp.R → R/flyhelp.R
@@ -16,9 +16,9 @@
#' Details(myfun) <- "This uses some pretty advanced math. You might need to read up on arithmetic"
#' Examples(myfun) <- "myfun(1, 2)"
#' \dontrun{
-#' fdHelp(myfun)
+#' flyhelp(myfun)
#' }
-fdHelp <- function(fun){
+flyhelp <- function(fun){
funname <- as.character(substitute(fun))
roxytext <- fdToRoxygen(fun, funname = funname)
View
16 README.md
@@ -21,24 +21,24 @@ Return(myfun) <- "The sum of x and y"
Details(myfun) <- "You might need to study some arithmetic to understand this function"
Examples(myfun) <- "myfunction(1, 2)"
# Will show the documentation just like a normal function
-fdHelp(myfun)
+flyhelp(myfun)
# Will run the examples stored in the documentation
-fdExample(myfun)
+flyexample(myfun)
```
-You can achieve essentially the same thing by using the example stored in `fdHelp`
+You can achieve essentially the same thing by using the example stored in `flyhelp`
```r
library(flydoc)
-example(fdHelp)
-fdHelp(myfun)
-fdExample(myfun)
+example(flyhelp)
+flyhelp(myfun)
+flyexample(myfun)
```
- - You can have your function in a script with documentation and read it in with the `fdRead` function (not yet implemented). There are two methods to store this documentation planned for the future. You can have roxygen2 style documenation comments in the source code that will be read, parsed, and converted to the appropriate format so that you can use the `fdHelp` function to display. The other alternative is to have normal comments directly after the function definition which will be used as the "description" in the help file. You can add further documentation using the accessor functions.
+ - You can have your function in a script with documentation and read it in with the `flyread` function (not yet implemented). There are two methods to store this documentation planned for the future. You can have roxygen2 style documenation comments in the source code that will be read, parsed, and converted to the appropriate format so that you can use the `flyhelp` function to display. The other alternative is to have normal comments directly after the function definition which will be used as the "description" in the help file. You can add further documentation using the accessor functions.
## Goals
1. Provide a way for users to access help documentation for functions that aren't currently installed in a package.
2. Make the transition to turning local functions into an actual package easier by eventually providing functionality similar to [Rd2roxygen](http://cran.r-project.org/web/packages/Rd2roxygen/index.html) that will generate roxygen comments for you and add them to the scripts directly.
- 3. Currently I'm settling on a less-than-ideal solution by using a separate function to access the help files for the documentation created with `flydoc` (`fdHelp`). Eventually I want this documentation to be accessible directly by using either `help(myflydocfunction)` or `?myflydocfunction`.
+ 3. Currently I'm settling on a less-than-ideal solution by using a separate function to access the help files for the documentation created with `flydoc` (`flyhelp`). Eventually I want this documentation to be accessible directly by using either `help(myflydocfunction)` or `?myflydocfunction`.
4. Currently I'm only allowing displaying text help and am using `file.show` for this. Unfortunately this doesn't work in RStudio so I need to find a workaround for that...
## Installation
View
6 man/fdExample.Rd → man/flyexample.Rd
@@ -1,8 +1,8 @@
-\name{fdExample}
-\alias{fdExample}
+\name{flyexample}
+\alias{flyexample}
\title{Run examples from flydoc function}
\usage{
- fdExample(fun)
+ flyexample(fun)
}
\arguments{
\item{fun}{The function that has flydoc documentation}
View
8 man/fdHelp.Rd → man/flyhelp.Rd
@@ -1,8 +1,8 @@
-\name{fdHelp}
-\alias{fdHelp}
+\name{flyhelp}
+\alias{flyhelp}
\title{Show the documentation for a flydoc function}
\usage{
- fdHelp(fun)
+ flyhelp(fun)
}
\arguments{
\item{fun}{The function to show the flydoc for}
@@ -22,7 +22,7 @@ Return(myfun) <- "The sum of x and y"
Details(myfun) <- "This uses some pretty advanced math. You might need to read up on arithmetic"
Examples(myfun) <- "myfun(1, 2)"
\dontrun{
-fdHelp(myfun)
+flyhelp(myfun)
}
}

0 comments on commit 43a521c

Please sign in to comment.
Something went wrong with that request. Please try again.