Package nima. May 23, 2018

Similar documents
Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package gameofthrones

Package harrypotter. September 3, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package ggextra. April 4, 2018

Package ggdark. R topics documented: January 11, Type Package Title Dark Mode for 'ggplot2' Themes Version Author Neal Grantham

Package vinereg. August 10, 2018

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package spark. July 21, 2017

Package projector. February 27, 2018

Package gppm. July 5, 2018

Package datasets.load

Package modmarg. R topics documented:

Package messaging. May 27, 2018

Package colf. October 9, 2017

Package fastdummies. January 8, 2018

Package crochet. January 8, 2018

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package repec. August 31, 2018

Package gridextra. September 9, 2017

Package ECctmc. May 1, 2018

Package tidyimpute. March 5, 2018

Package meme. November 2, 2017

Package memery. February 13, 2018

Package wrswor. R topics documented: February 2, Type Package

Package profvis. R topics documented:

Package psda. September 5, 2017

Package docxtools. July 6, 2018

Package sfc. August 29, 2016

Package vip. June 15, 2018

Package reval. May 26, 2015

Package meme. December 6, 2017

Package MTLR. March 9, 2019

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package fbroc. August 29, 2016

Package balance. October 12, 2018

Package stapler. November 27, 2017

Package DataExplorer

Package farver. November 20, 2018

Package quickreg. R topics documented:

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package semver. January 6, 2017

Package caretensemble

Package qualmap. R topics documented: September 12, Type Package

Package tidylpa. March 28, 2018

Package canvasxpress

Package catenary. May 4, 2018

Package linkspotter. July 22, Type Package

Package statip. July 31, 2018

Package labelvector. July 28, 2018

Package barcoder. October 26, 2018

Package carbonate. R topics documented: October 14, 2018

Package WordR. September 7, 2017

Package ggloop. October 20, 2016

Package interplot. R topics documented: June 30, 2018

Package listdtr. November 29, 2016

Package wikitaxa. December 21, 2017

Package PCADSC. April 19, 2017

Package bisect. April 16, 2018

Package splines2. June 14, 2018

Package ggrepel. September 30, 2017

Package fitur. March 11, 2018

Package preprocomb. June 26, 2016

Package sure. September 19, 2017

Package embed. November 19, 2018

Package available. November 17, 2017

Package anomalydetection

Package fastqcr. April 11, 2017

Package vdiffr. April 27, 2018

Package queuecomputer

Package facerec. May 14, 2018

Package rtext. January 23, 2019

Package validara. October 19, 2017

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package spelling. December 18, 2017

Package fitbitscraper

Package redlistr. May 11, 2018

Package lvplot. August 29, 2016

Package milr. June 8, 2017

Package nngeo. September 29, 2018

Package ezsummary. August 29, 2016

Package kdtools. April 26, 2018

Package slickr. March 6, 2018

Package strat. November 23, 2016

Package CompGLM. April 29, 2018

Package lucid. August 24, 2018

Package triebeard. August 29, 2016

Package dotwhisker. R topics documented: June 28, Type Package

Package NNLM. June 18, 2018

Package IRkernel. January 7, 2019

Package preprosim. July 26, 2016

Package githubinstall

Package darksky. September 20, 2017

Package anomalize. April 17, 2018

Package filematrix. R topics documented: February 27, Type Package

Package mdftracks. February 6, 2017

Package cowplot. March 6, 2016

Package fastrtext. December 10, 2017

Transcription:

Title Nima Hejazi's R Toolbox Version 0.5.0 Package nima May 23, 2018 Miscellaneous R functions developed over the course of statistical research and scientific computing. These include, for example, utilities that supplement existing idiosyncrasies of the R language, extend existing plotting functionality and aesthetics, provide alternative presentations of matrix decompositions, and extend access to command line tools and systems-level information. Maintainer Nima Hejazi <nh@nimahejazi.org> Depends R (>= 3.2.3) Imports utils, stats, gtools, survival, gridextra, assertthat, ProjectTemplate, devtools, ggthemes, ggplot2, scales, plyr, grid Suggests knitr, roxygen2, testthat License MIT + file LICENSE URL https://github.com/nhejazi/nima BugReports https://github.com/nhejazi/nima/issues Encoding UTF-8 LazyData true RoxygenNote 6.0.1.9000 NeedsCompilation no Author Nima Hejazi [aut, cre, cph] (<https://orcid.org/0000-0002-7127-2789>) Repository CRAN Date/Publication 2018-05-21 17:13:08 R topics documented: absmax........................................... 2 attrnames.......................................... 3 clear............................................. 3 1

2 absmax commas........................................... 4 compfun.......................................... 4 discrete_by_quantile.................................... 5 exit............................................. 6 factornum.......................................... 6 hweb............................................. 7 lmplots_gg......................................... 7 miss_ind........................................... 8 mse............................................. 8 openfile........................................... 9 qqplot_gg.......................................... 9 qrd............................................. 10 scale_color_nima...................................... 11 scale_fill_nima....................................... 11 theme_jetblack....................................... 11 theme_nima......................................... 12 uniqlen........................................... 13 Index 14 absmax Maximum of Absolute s of Vector Take the maximum of the absolute values of an input vector. absmax(x, na.rm = FALSE) x na.rm A numeric vector or array. A logical indicating whether missing values should be removed. The maximum of the absolute values of elements of the input vector. x <- c(5, 3, -9, -100, 3.14159, 7.5) absmax(x)

attrnames 3 attrnames Get Names of Attributes Get the names of the attributes of an input object. attrnames(obj) obj Any object. Vector of character strings with the names of the attributes. x <- matrix(1:100, ncol=5) colnames(x) <- LETTERS[1:5] attrnames(x) clear Clear the Current Screen/Buffer Clear the screen with a call to system and clear. clear() Details This function is merely a call to system("clear") system("clear")

4 compfun commas Add Commas to a Large Number Convert a number to a string, with commas inserted at every 3rd digit. commas(numbers) numbers Vector of non-negative numbers (will be rounded to integers) Character string with numbers written like "5,771,009". commas(c(2300, 9000, 21456, 987654890, 1256787, 345765, 1432)) compfun Compare Two Similar Objects including Missing Data Patterns. Check whether two objects are the same, including patterns of NAs. compfun(a, b) a b An object of a given type. An object similar in type to that given above. Boolean object with TRUE indicating an element is the same.

discrete_by_quantile 5 x <- c(5, 8, 9, NA, 3, NA) y <- c(5, 2, 9, 4, NA, NA) compfun(x,y) x <- matrix(rnorm(1000), ncol = 20) x[sample(seq(along = x), 100)] <- NA all(compfun(x,x)) dim(compfun(x,x)) x <- as.list(c(5, 8, 9, NA, 3, NA)) y <- as.list(y) sapply(compfun(x,y), function(a) sum(!a)) x <- as.data.frame(x) y <- as.data.frame(y) sum(!compfun(x,y)) discrete_by_quantile Discretize a vector Discretizes a non-factor input vector and returns the result as numeric. discrete_by_quantile(x) x A vector containing arbitrary data. A numeric vector with the data re-coded to based on the quantiles. x <- rnorm(1000) discrete_by_quantile(x)

6 factornum exit Exit R Without Saving Exit R without saving workspace, using the ubiquitous UNIX syntax. exit() Details This function is merely a call to q("no"). factornum Convert a Factor to Numeric Convert a factor with numeric levels to a non-factor (numeric). factornum(x) x A vector containing a factor with numeric levels. The input factor made into a numeric vector. x <- factor(c(3, 4, 9, 4, 9), levels = c(3,4,9)) factornum(x)

hweb 7 hweb View HTML Version of Help Files View the HTML version of a help file while running R from the terminal. hweb(...)... Help topics. Details Calls function help using argument htmlhelp=true. See Also help, help.start hweb(read.table) lmplots_gg Linear Model Diagnostic Plots with ggplot2 Produce standard diagnostic plots for linear models using ggplot2. lmplots_gg(model) model A linear model object produced by lm(). n <- 100; x1 <- rnorm(n); y1 <- rnorm(n); linmod <- lm(y1 ~ x1) lmplots_gg(linmod)

8 mse miss_ind Add missingness indicators to existing data object Add indicator columns to a data.frame showing the pattern of missingness. miss_ind(data, prefix = "miss_") data prefix A numeric vector or array. A string used to name the indicator variables.. An augmented data.frame with indicators for missingness patterns. data <- data.frame(cbind(rnorm(10), runif(10))) data[sample(nrow(data), 3), 1] <- NA data[sample(nrow(data), 4), 2] <- NA data <- miss_ind(data) mse Mean Squared Error (MSE) Easily compute the mean squared error for continuous predictions mse(prediction, outcome) prediction outcome A numeric vector of predictions. A numeric vector of outcomes actually observed.

openfile 9 x <- rnorm(100) y <- x^2 test_x <- rnorm(100) test_y <- test_x^2 mod <- glm(y ~ x) pred <- predict(mod, newx = as.data.frame(test_x)) error <- mse(prediction = pred, outcome = test_y) openfile Open a File Open a file using system and open. openfile(file) file File name (as character string). Details Open files from R by using the default operating system program. openfile("myplot.pdf") qqplot_gg Quantile-Quantile Plots with ggplot2 Produce standard quantile-quantile plots for modeling using ggplot2. qqplot_gg(x, distribution = "norm",..., line.estimate = NULL, conf = 0.95, labels = names(x))

10 qrd x A numeric vector of residuals from a generalized linear model. distribution The reference probability distribution for residuals.... Any additional parameters to be passed to distribution functions. line.estimate Should quantiles be estimated, if so which quantiles? conf The confidence level to be used with confidence intervals. labels The names to be used when identifying points on the Q-Q plot. n <- 100; x1 <- rnorm(n); y1 <- rnorm(n); linmod <- lm(y1 ~ x1) x <- linmod$residuals qqplot_gg(x) qrd The QR decomposition of a matrix Computes the QR decomposition of a matrix. qrd(x, tol = 1e-07) x A matrix whose QR decomposition is to be computed. tol The tolerance for finding linear dependence in columns of x. Details Calls function qr and returns more understandable output. A list of two matrices: Q and R. See Also qr hilbert <- function(n) { i <- 1:n; 1/outer(i-1,i,"+") } h5 <- hilbert(5); qrd(h5)

scale_color_nima 11 scale_color_nima Nima s ggplot2 theme - supplement: scale_color Nima s ggplot2 theme scale_color supplement: colors optimized via ColorBrewer scale_color_nima(...)... Passed to ggplot scale_fill_nima Nima s ggplot2 theme - supplement: scale_fill Nima s ggplot2 theme scale_fill supplement: colors optimized via ColorBrewer scale_fill_nima(...)... Passed to ggplot theme_jetblack A jet black ggplot2 theme with inverted colors A jet black ggplot2 theme with inverted colors theme_jetblack(base_size = 12, base_family = "")

12 theme_nima See Also base_size base_family Base font size Base font family... Passed to theme An object as returned by theme theme library(ggplot2) p <- ggplot(mtcars, aes(y = mpg, x = disp, color = factor(cyl))) p <- p + geom_point() + theme_jetblack() p theme_nima Nima s ggplot2 theme Nima s ggplot2 theme: white background, colors optimized theme_nima(base_size = 14, base_family = "Helvetica") nima_theme(base_size = 14, base_family = "Helvetica") base_size Base font size base_family Base font family... Passed to theme An object as returned by theme See Also theme

uniqlen 13 library(ggplot2) p <- ggplot(mtcars, aes(y = mpg, x = disp, color = factor(cyl))) p <- p + geom_point() + scale_fill_nima() + scale_color_nima() + theme_nima() p uniqlen Find Number of Unique s Get the number of unique values in an input vector. uniqlen(vec, na.rm = TRUE) vec na.rm A vector of any type. If TRUE, remove missing values. Number of unique values. x <- c(1, 3, 1, 1, NA, 2, 2, 3, NA, NA, 1, 3, 1) uniqlen(x) uniqlen(x, na.rm = FALSE)

Index absmax, 2 attrnames, 3 clear, 3 commas, 4 compfun, 4 discrete_by_quantile, 5 exit, 6 factornum, 6 ggplot, 11 help, 7 help.start, 7 hweb, 7 lmplots_gg, 7 miss_ind, 8 mse, 8 nima_theme (theme_nima), 12 openfile, 9 qqplot_gg, 9 qr, 10 qrd, 10 scale_color_nima, 11 scale_fill_nima, 11 system, 3, 9 theme, 12 theme_jetblack, 11 theme_nima, 12 uniqlen, 13 14