Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner namespace & doc using roxygen2 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ Maintainer: Vincent Q. Vu <vqv@stat.cmu.edu>
Description: A ggplot2 based biplot. It provides a drop-in
replacement for biplot.princomp(). It implements a
biplot and scree plot using ggplot2.
Depends:
Imports:
ggplot2, plyr, scales, grid
License: GPL-2
URL: http://github.com/vqv/ggbiplot
Collate:
'ggbiplot.r'
'ggscreeplot.r'
'data.r'
RoxygenNote: 6.0.1
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Generated by roxygen2: do not edit by hand

export(ggbiplot)
export(ggscreeplot)
import(ggplot2)
import(grid)
import(plyr)
import(scales)
import(stats)
24 changes: 24 additions & 0 deletions R/data.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#' @name wine.class
#' @docType data
#' @title Cultivars of the wines in the wine dataset.
#' @description Cultivars of the wines in the wine dataset, same length as the
#' dataset has rows.
#' @format Factor of length 178 with 3 levels "barolo", "grignolino", and "barbera".
NULL


#' @name wine
#' @aliases wine
#' @docType data
#' @title Chemical composition of three cultivars of wine
#' @description Chemical constituents of wines from three different cultivars grown
#' in the same region in Italy. The cultivars, 'barolo', 'barbera', and
#' 'grignolino', are indicated in wine.class.
#' @format The format is: chr "wine"
#' @source http://archive.ics.uci.edu/ml/datasets/Wine
#' @examples data(wine)
#' wine.pca <- prcomp(wine, scale. = TRUE)
#' print(ggscreeplot(wine.pca))
#' print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class,
#' ellipse = TRUE, circle = TRUE))
NULL
13 changes: 5 additions & 8 deletions R/ggbiplot.r
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@
#' @param labels.size size of the text used for the labels
#' @param alpha alpha transparency value for the points (0 = transparent, 1 = opaque)
#' @param circle draw a correlation circle? (only applies when prcomp was called with scale = TRUE and when var.scale = 1)
#' @param circle.prob size of the circle
#' @param var.axes draw arrows for the variables?
#' @param varname.size size of the text for variable names
#' @param varname.adjust adjustment factor the placement of the variable names, >= 1 means farther from the arrow
#' @param varname.abbrev whether or not to abbreviate the variable names
#'
#' @return a ggplot2 plot
#' @import ggplot2 plyr scales grid stats
#' @export
#' @examples
#' data(wine)
#' wine.pca <- prcomp(wine, scale. = TRUE)
#' print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE))
#' print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class,
#' ellipse = TRUE, circle = TRUE))
#'
ggbiplot <- function(pcobj, choices = 1:2, scale = 1, pc.biplot = TRUE,
obs.scale = 1 - scale, var.scale = scale,
Expand All @@ -52,13 +55,7 @@ ggbiplot <- function(pcobj, choices = 1:2, scale = 1, pc.biplot = TRUE,
var.axes = TRUE,
circle = FALSE, circle.prob = 0.69,
varname.size = 3, varname.adjust = 1.5,
varname.abbrev = FALSE, ...)
{
library(ggplot2)
library(plyr)
library(scales)
library(grid)

varname.abbrev = FALSE) {
stopifnot(length(choices) == 2)

# Recover the SVD
Expand Down
1 change: 1 addition & 0 deletions ggbiplot.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ LaTeX: XeLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,namespace
78 changes: 33 additions & 45 deletions man/ggbiplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions man/ggscreeplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 12 additions & 15 deletions man/wine.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/wine.class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.