new small function

This commit is contained in:
agdamsbo 2019-12-16 15:15:51 +01:00
parent e10228bdec
commit 18b387ce14
4 changed files with 40 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Package: daDoctoR
Title: Functions For Health Research
Version: 0.19.13
Version: 0.19.14
Year: 2019
Author: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>

View File

@ -31,3 +31,4 @@ export(strobe_diff_twodim)
export(strobe_log)
export(strobe_olr)
export(strobe_pred)
export(substrRight)

16
R/substrRight.R Normal file
View File

@ -0,0 +1,16 @@
#' Substring n last characters
#'
#'
#' @param x vector
#' @param n number of string elements to
#' @keywords substr
#' @export
#' @examples
#' ##Kim Larsen
#' cpr<-"231045-0637"
#' substrRight(cpr,4)
substrRight <- function(x, n){
r<-nchar(x)
substr(x, r-n+1, r)
}

22
man/substrRight.Rd Normal file
View File

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/substrRight.R
\name{substrRight}
\alias{substrRight}
\title{Substring n last characters}
\usage{
substrRight(x, n)
}
\arguments{
\item{x}{vector}
\item{n}{number of string elements to}
}
\description{
Substring n last characters
}
\examples{
##Kim Larsen
cpr<-"231045-0637"
substrRight(cpr,4)
}
\keyword{substr}