Permalink
Browse files

First pass at documentation.

  • Loading branch information...
1 parent 15fe3ed commit 6e8ba6eda73638da8fcc0baeb5ac9a0cd23d261c @ankitrohatgi committed May 13, 2015
Showing with 137 additions and 49 deletions.
  1. +9 −4 DESCRIPTION
  2. +1 −1 R/app.R
  3. +42 −2 R/digitizeR.R
  4. +1 −0 digitizeR.Rproj
  5. +0 −42 man/digitizeR-package.Rd
  6. +24 −0 man/digitizeR.Rd
  7. +18 −0 man/wpd.close.Rd
  8. +15 −0 man/wpd.isOpen.Rd
  9. +27 −0 man/wpd.launch.Rd
View
@@ -1,13 +1,18 @@
Package: digitizeR
Type: Package
-Title: Extract numerical data from images of plots, maps and other images.
+Title: Tool to extract numerical data from images of plots, maps etc.
Version: 1.0
Date: 2015-05-11
-Author: Ankit Rohatgi
+Authors@R: person("Ankit", "Rohatgi", email = "ankitrohatgi@hotmail.com", role = c("aut", "cre"))
Maintainer: Ankit Rohatgi <ankitrohatgi@hotmail.com>
-Description: Host WebPlotDigitizer locally.
+Description: Locally hosted WebPlotDigitizer that helps with interactive digitization of plots
+ and also make simple distance and angle measurements. See WebPlotDigitizer website for more
+ details.
+URL: http://github.com/ankitrohatgi/digitizeR
+BugReports: http://github.com/ankitrohatgi/digitizeR/issues
License: GPL-3
-Depends: R (>= 3.1.0)
+Depends:
+ R (>= 3.1.0)
Imports:
httpuv,
mime,
View
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with digitizeR. If not, see <http://www.gnu.org/licenses/>.
-wpd.createBackend <- function() {
+.wpd.createBackend <- function() {
backend <- list(
call = function(req) {
# Handle HTTP requests
View
@@ -13,13 +13,44 @@
# You should have received a copy of the GNU General Public License
# along with digitizeR. If not, see <http://www.gnu.org/licenses/>.
+#' digitizeR: Tool to extract numerical data from images of plots, maps etc.
+#'
+#' The digitizeR package provides a web based interface (WebPlotDigitizer) to interactively extract
+#' numerical data from images of plots, maps, microscope images etc. Some tools to make simple distance
+#' and angle measurements are also available. In the future, this package will also allow
+#' real-time interaction between R and the hosted web application via WebSockets.
+#'
+#' @section Available Functions:
+#'
+#' \itemize{
+#' \item \code{\link{wpd.launch}}: Start HTTP server that hosts WebPlotDigitizer and
+#' open the local URL in the browser.
+#' \item \code{\link{wpd.close}}: Shutdown the HTTP server.
+#' \item \code{\link{wpd.isOpen}}: Check is the HTTP server is currently running.
+#' }
+#'
+#'
+#' @docType package
+#' @name digitizeR
+NULL
+#' Start a local HTTP server that hosts WebPlotDigitizer.
+#' This will also open a browser window pointing to the local URL.
+#'
+#' @param location IP address or machine name of the server. Defaults to "0.0.0.0".
+#' @param port Port number of the HTTP server. Defaults to 8000.
+#' @return Server handle that is later used to shutdown the server using wpd.close()
+#' @export
+#' @examples
+#' app = wpd.launch()
+#' app = wpd.launch(port=8080)
+#' app = wpd.launch(location="192.168.1.100", port=8080)
wpd.launch <- function(location = '0.0.0.0', port = 8000) {
app <- new.env()
# Start httpuv based server in the background
- app$backend = wpd.createBackend()
+ app$backend = .wpd.createBackend()
app$serverInstance <- httpuv::startDaemonizedServer(location, port, app$backend)
@@ -39,7 +70,12 @@ wpd.launch <- function(location = '0.0.0.0', port = 8000) {
return(app)
}
-
+#' Shutdown the HTTP server that is currently hosting WebPlotDigitizer.
+#'
+#' @param app Server handle that was obtained by executing wpd.launch()
+#' @export
+#' @examples
+#' wpd.close(app)
wpd.close <- function(app) {
if (app$isOpen) {
cat("Shutting down WPD server\n")
@@ -48,6 +84,10 @@ wpd.close <- function(app) {
}
}
+#' Check if the HTTP server is currently running.
+#'
+#' @param app Server handle that was obtained by executng wpd.launch()
+#' @export
wpd.isOpen <- function(app) {
return(app$isOpen)
}
View
@@ -15,3 +15,4 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
+PackageRoxygenize: rd
@@ -1,42 +0,0 @@
-\name{digitizeR-package}
-\alias{digitizeR-package}
-\alias{digitizeR}
-\docType{package}
-\title{
-Extract data from images of plots, maps and other images.
-~~ digitizeR ~~
-}
-\description{
-More about what it does (maybe more than one line)
-~~ A concise (1-5 lines) description of the package ~~
-}
-\details{
-\tabular{ll}{
-Package: \tab digitizeR\cr
-Type: \tab Package\cr
-Version: \tab 1.0\cr
-Date: \tab 2015-05-11\cr
-License: \tab What license is it under?\cr
-}
-~~ An overview of how to use the package, including the ~~
-~~ most important functions ~~
-}
-\author{
-Ankit Rohatgi
-
-Maintainer: Ankit Rohatgi <ankitrohatgi@hotmail.com>
-~~ Ankit Rohatgi ~~
-}
-\references{
-~~ Literature or other references for background information ~~
-}
-~~ Optionally other standard keywords, one per line, ~~
-~~ from file KEYWORDS in the R documentation directory ~~
-\keyword{ package }
-\seealso{
-~~ Optional links to other man pages, e.g. ~~
-~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
-}
-\examples{
-~~ simple examples of the most important functions ~~
-}
View
@@ -0,0 +1,24 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/digitizeR.R
+\docType{package}
+\name{digitizeR}
+\alias{digitizeR}
+\alias{digitizeR-package}
+\title{digitizeR: Tool to extract numerical data from images of plots, maps etc.}
+\description{
+The digitizeR package provides a web based interface (WebPlotDigitizer) to interactively extract
+numerical data from images of plots, maps, microscope images etc. Some tools to make simple distance
+and angle measurements are also available. In the future, this package will also allow
+real-time interaction between R and the hosted web application via WebSockets.
+}
+\section{Available Functions}{
+
+
+\itemize{
+ \item \code{\link{wpd.launch}}: Start HTTP server that hosts WebPlotDigitizer and
+ open the local URL in the browser.
+ \item \code{\link{wpd.close}}: Shutdown the HTTP server.
+ \item \code{\link{wpd.isOpen}}: Check is the HTTP server is currently running.
+}
+}
+
View
@@ -0,0 +1,18 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/digitizeR.R
+\name{wpd.close}
+\alias{wpd.close}
+\title{Shutdown the HTTP server that is currently hosting WebPlotDigitizer.}
+\usage{
+wpd.close(app)
+}
+\arguments{
+\item{app}{Server handle that was obtained by executing wpd.launch()}
+}
+\description{
+Shutdown the HTTP server that is currently hosting WebPlotDigitizer.
+}
+\examples{
+wpd.close(app)
+}
+
View
@@ -0,0 +1,15 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/digitizeR.R
+\name{wpd.isOpen}
+\alias{wpd.isOpen}
+\title{Check if the HTTP server is currently running.}
+\usage{
+wpd.isOpen(app)
+}
+\arguments{
+\item{app}{Server handle that was obtained by executng wpd.launch()}
+}
+\description{
+Check if the HTTP server is currently running.
+}
+
View
@@ -0,0 +1,27 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/digitizeR.R
+\name{wpd.launch}
+\alias{wpd.launch}
+\title{Start a local HTTP server that hosts WebPlotDigitizer.
+This will also open a browser window pointing to the local URL.}
+\usage{
+wpd.launch(location = "0.0.0.0", port = 8000)
+}
+\arguments{
+\item{location}{IP address or machine name of the server. Defaults to "0.0.0.0".}
+
+\item{port}{Port number of the HTTP server. Defaults to 8000.}
+}
+\value{
+Server handle that is later used to shutdown the server using wpd.close()
+}
+\description{
+Start a local HTTP server that hosts WebPlotDigitizer.
+This will also open a browser window pointing to the local URL.
+}
+\examples{
+app = wpd.launch()
+app = wpd.launch(port=8080)
+app = wpd.launch(location="192.168.1.100", port=8080)
+}
+

0 comments on commit 6e8ba6e

Please sign in to comment.