Skip to content

Commit

Permalink
Change newJSON back to createJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Nov 26, 2014
1 parent 233f4bf commit 81be601
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by roxygen2 (4.0.2): do not edit by hand

export(newJSON)
export(createJSON)
export(runShiny)
export(serVis)
6 changes: 3 additions & 3 deletions R/newjson.R → R/createJSON.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Create the JSON object to read into the javascript visualization
#'
#' This function creates the JSON object that feeds the visualization template.
#' For a more detailed overview, see \code{vi}
#' For a more detailed overview, see \code{vignette("details", package = "LDAvis")}
#'
#' @param phi matrix, with each row containing the distribution over terms
#' for a topic, with as many rows as there are topics in the model, and as
Expand Down Expand Up @@ -64,7 +64,7 @@
#' data(AP, package="LDAvis")
#'
#' # create the json object:
#' json <- newJSON(phi = AP$phi, theta = AP$theta, alpha = AP$alpha,
#' json <- createJSON(phi = AP$phi, theta = AP$theta, alpha = AP$alpha,
#' beta = AP$beta, doc.length = AP$doc.length,
#' vocab = AP$vocab, term.frequency = AP$term.frequency,
#' R = 30, print.progress = TRUE)
Expand All @@ -84,7 +84,7 @@
#' serVis(json, as.gist = TRUE)
#'}

newJSON <- function(phi = matrix(), theta = matrix(), alpha = numeric(),
createJSON <- function(phi = matrix(), theta = matrix(), alpha = numeric(),
beta = numeric(), doc.length = integer(),
vocab = character(), term.frequency = integer(), R = 30,
quiet = FALSE) {
Expand Down
14 changes: 8 additions & 6 deletions R/serVis.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#' Serve the javascript version of LDAvis
#' View/share LDAvis
#'
#' This function will place the necessary html/js/css files (located in
#' system.file("html", package = "LDAvis"))
#' in a directory specified by the argument out.dir. Then, if appropriate,
#' Then, if appropriate,
#' the function will prompt your browser to serve the visualization.
#'
#' @details This function will place the necessary html/js/css files (located in
#' \code{system.file("htmljs", package = "LDAvis")}) in a directory specified
#' by the argument \code{out.dir}.
#'
#' @param json character string output from the \link{createjson} function.
#'
#' @param out.dir directory to store html/js/json files.
Expand All @@ -17,11 +19,11 @@
#' @param as.gist should the vis be uploaded as a gist? If so, make sure your
#' 'github.username' and 'github.password' are set in \link{options}.
#'
#' @param ... arguments passed onto gistr::gist_create if as.gist is TRUE
#' @param ... arguments passed onto \code{gistr::gist_create}
#'
#' @return An invisible object.
#'
#' @seealso \link{newJSON}
#' @seealso \link{createJSON}
#' @export
#' @author Carson Sievert
#'
Expand Down
10 changes: 5 additions & 5 deletions man/newJSON.Rd → man/createJSON.Rd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
% Generated by roxygen2 (4.0.2): do not edit by hand
\name{newJSON}
\alias{newJSON}
\name{createJSON}
\alias{createJSON}
\title{Create the JSON object to read into the javascript visualization}
\usage{
newJSON(phi = matrix(), theta = matrix(), alpha = numeric(),
createJSON(phi = matrix(), theta = matrix(), alpha = numeric(),
beta = numeric(), doc.length = integer(), vocab = character(),
term.frequency = integer(), R = 30, quiet = FALSE)
}
Expand Down Expand Up @@ -52,7 +52,7 @@ file or feed into \link{serVis} for easy viewing/sharing.
\description{
This function creates the JSON object that feeds the
visualization template. For a more detailed overview, see
\code{vi}
\code{vignette("details", package = "LDAvis")}
}
\details{
The function first computes the topic frequencies (across
Expand All @@ -73,7 +73,7 @@ If \code{print.progress = TRUE} progress in this loop
data(AP, package="LDAvis")

# create the json object:
json <- newJSON(phi = AP$phi, theta = AP$theta, alpha = AP$alpha,
json <- createJSON(phi = AP$phi, theta = AP$theta, alpha = AP$alpha,
beta = AP$beta, doc.length = AP$doc.length,
vocab = AP$vocab, term.frequency = AP$term.frequency,
R = 30, print.progress = TRUE)
Expand Down
19 changes: 11 additions & 8 deletions man/serVis.Rd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Generated by roxygen2 (4.0.2): do not edit by hand
\name{serVis}
\alias{serVis}
\title{Serve the javascript version of LDAvis}
\title{View/share LDAvis}
\usage{
serVis(json, out.dir = tempfile(), open.browser = interactive(),
as.gist = FALSE, ...)
Expand All @@ -22,18 +22,21 @@ serVis(json, out.dir = tempfile(), open.browser = interactive(),
so, make sure your 'github.username' and
'github.password' are set in \link{options}.}

\item{...}{arguments passed onto gistr::gist_create if
as.gist is TRUE}
\item{...}{arguments passed onto
\code{gistr::gist_create}}
}
\value{
An invisible object.
}
\description{
Then, if appropriate, the function will prompt your browser
to serve the visualization.
}
\details{
This function will place the necessary html/js/css files
(located in system.file("html", package = "LDAvis")) in a
directory specified by the argument out.dir. Then, if
appropriate, the function will prompt your browser to serve
the visualization.
(located in \code{system.file("htmljs", package =
"LDAvis")}) in a directory specified by the argument
\code{out.dir}.
}
\examples{
\dontrun{
Expand All @@ -44,6 +47,6 @@ help(createJSON, package = "LDAvis")
Carson Sievert
}
\seealso{
\link{newJSON}
\link{createJSON}
}

0 comments on commit 81be601

Please sign in to comment.