Learn R Programming

CUFF (version 1.0)

strutils: Utility functions to treat characters

Description

Function %+% paste characters with other characters pairwise. Function %n% is used to repeat a character n time. Function numtostr converts numeric to a string in a nice format.

Usage

x %+% y
x %n% y
numtostr(x,nch,digits=4)

Arguments

x
Character vector or a numeric vector for numtostr functions
y
Character vector
nch
(Optionnal) length of the resulting character vector
digits
Number of digits in the resulting strings

Value

  • Function %+% is an operator that shortens paste(x, y, sep="") see help(paste) for more options. Function %n% returns the character vector x repeated y times. If both x and y are vector each element of x are applied to each element of y. Function numtostr converts numerical vector to a character vector using a nice format.

encoding

utf-8

Examples

Run this code
require(CUFF)
"Hello " %+% "world."
cat("" %n%  c(rep(1,9),2) %+% 1:10,fill=TRUE)
### Returns a * because specified length of character is unsufficient. 
numtostr(9048948449.94948,nch=8)

Run the code above in your browser using DataLab