Learn R Programming

NCmisc (version 1.3.1)

Miscellaneous Functions for Creating Adaptive Functions and Scripts

Description

A set of handy functions. Includes a versatile one line progress bar, one line function timer with detailed output, time delay function, text histogram, object preview, CRAN package search, simpler package installer, Linux command install check, a flexible Mode function, top function, simulation of correlated data, and more.

Copy Link

Version

Install

install.packages('NCmisc')

Monthly Downloads

1,877

Version

1.3.1

License

GPL (>= 2)

Maintainer

Nicholas Cooper

Last Published

February 19th, 2026

Functions in NCmisc (1.3.1)

Header

Print heading text with a border.
loop.tracker

Creates a progess bar within a loop
standardize

Convert a numeric vector to Z-scores.
summarise.r.datasets

Summarise the dimensions and type of available R example datasets
loess.scatter

Draw a scatterplot with a fit line
out.of

Easily display fraction and percentages
sim.cor

Simulate a dataset with correlated measures
search.cran

Search all CRAN packages for those containing keyword(s).
p.to.Z

Convert p-values to Z-scores
extend.pc

Extend an interval by percentage
textogram

Make an ascii histogram in the console.
timeit

Times an expression, with breakdown of time spent in each function !DEPRECATED October 14, 2022!
force.percentage

Force argument to be a percentage with length one
comify

Function to add commas for large numbers
has.method

Determine whether a function can be applied to an S4 class/object
wait

Wait for a period of time.
Mode

Find the mode of a vector.
comma.list

Print out comma separated list of values in X, truncating if many (good for error messages)
NCmisc-internal

Internal NCmisc Functions
cor.with

Simulate a correlated variable
list.functions.in.file

Show all functions used in an R script file, by package
headl

A good way to preview large lists.
which.outlier

Return vector indexes of statistical univariate outliers
must.use.package

Do everything possible to load an R package.
memory.summary

Summary of RAM footprint for all R objects in the current session. Not my function, but taken from an R-Help response by Elizabeth Purdom, at Berkeley. Simply applies the function 'object.size' to the objects in ls(). Also very similar to an example in the 'Help' for the utils::object.size() function.
table2d

Wrapper for the base table() function that includes zero counts - useful to get consistent dimensions across multiple runs with different responding patterns Forces a 2d table with every possible cell (allow zero counts) Only for tables where there are two vectors entered, while the base function allows for more, or also allows just 1. If the wrong arguments are entered, attempts to pass the input to the base version of 'table' instead.
preview

Output variable states within functions during testing/debugging
summary2

Descriptive summary with SD/SE + improved formatting
prv

Output variable states within functions/loops during testing/debugging
pad.left

Print a vector with appropriate padding so each has equal char length.
force.scalar

Force argument to be a numeric type with length one
packages.loaded

Check whether a set of packages has been loaded
pctile

Find data thresholds corresponding to percentiles
ppa

Posterior probability of association function
prv.large

Tidy display function for matrix objects
list.to.env

Create variables from a list
replace.missing.df

Iterate through numeric columns of a dataframe and replace missing with the mean
toheader

Return a string with each first letter of each word in upper case.
top

Monitor CPU, RAM and Processes
rmv.spc

Remove leading and trailing spaces (or other character).
nearest.to

Select the nearest point in an array to a given value
rmv.names

Remove names from a named vector or list
narm

Return an object with missing values removed.
spc

Print a character a specified number of times.
simple.date

Simple representation and retrieval of Date/Time
Numerify

Convert all possible columns of a data.frame to numeric
Unlist

Unlist a list, starting only from a set depth.
NCmisc-package

Miscellaneous Functions for Creating Adaptive Functions and Scripts
Rfile.index

Create an index file for an R function file
Substitute

Convert objects as arguments to object names
Dim

A more general dimension function
Z.to.p

Convert Z-scores to p-values
fakeLines

Create fake text for testing purposes
file.split

Split a text file into multiple parts
check.linux.install

Check whether a given system command is installed (e.g, bash)
dup.pairs

Obtain an index of all instances of values with duplicates (ordered)
get.distinct.cols

Return up to 22 distinct colours.
getRepositories

Detect all available R repositories.
is.vec.logical

Determine robustly whether a vector contains logical data
estimate.memory

Estimate the memory required for an object.
exists.not.function

Does object exist ignoring functions The exists() function can tell you whether an object exists at all, or whether an object exists with a certain type, but it can be useful to know whether an object exists as genuine data (and not a function) which can be important when a variable or object is accidently or intentionally given the same name as a function. This function usually returns a logical value as to the existence of the object (ignoring functions) but can also be set to return the non-function type if the object exists.
is.vec.numeric

Determine robustly whether a vector contains numeric data