~enricoschumann/esutils

80c6b5e7946aedbd206d0398bb420d767e660155 — Enrico Schumann 2 years ago 957bb99
Prepare version 0.3.1

Move function "insert" to package "textutils".
7 files changed, 22 insertions(+), 38 deletions(-)

M ChangeLog
M DESCRIPTION
M NAMESPACE
M NEWS
M R/functions.R
D inst/tinytest/test_insert.R
M man/backup.Rd
M ChangeLog => ChangeLog +7 -0
@@ 1,3 1,10 @@
2022-09-06  Enrico Schumann  <es@enricoschumann.net>

        * DESCRIPTION (Version): 0.3.1

        * R/functions.R (insert): move function to package
        "textutils"

2022-09-03  Enrico Schumann  <es@enricoschumann.net>

        * DESCRIPTION (Version): 0.3.0

M DESCRIPTION => DESCRIPTION +2 -2
@@ 1,8 1,8 @@
Package: esutils
Type: Package
Title: esutils
Version: 0.3.0
Date: 2022-09-03
Version: 0.3.1
Date: 2022-09-06
Maintainer: Enrico Schumann <es@enricoschumann.net>
Authors@R: person(given = "Enrico", family = "Schumann",
                  role  = c("aut", "cre"),

M NAMESPACE => NAMESPACE +0 -1
@@ 41,7 41,6 @@ export(
    "git_bundle_create",
    "git_bundle_pull",
    "header",
    "insert",
    "latest_version",
    "make_tex",
    "map01",

M NEWS => NEWS +6 -1
@@ 1,4 1,9 @@
v0.3-0  (2022-09-03)
v0.3.1  (2022-09-06)

  o function "insert" was moved to package "textutils"
    ( http://enricoschumann.net/R/packages/textutils/ )

v0.3.0  (2022-09-03)

  o pkg_build: new argument "as.cran"


M R/functions.R => R/functions.R +0 -16
@@ 623,22 623,6 @@ sw_names <- function(filename, names.only = FALSE) {
        unlist(lapply(opts, `[[`, "label"))
}

insert <- function(x, what, before.index) {
    if (is.unsorted(before.index)) {
        ii <- order(before.index)
        what <- what[ii]
        before.index <- before.index[ii]
    }
    if (length(what) < length(before.index))
        what <- rep(what, length(before.index)/length(what))
    before.index <- before.index +
        seq(from = 0, to = length(what) - 1)
    ans <- vector(class(x), length(x) + length(what))
    ans[ before.index] <- what
    ans[-before.index] <- x
    ans
}

zoo2array <- function(z) {

    paste0("[new Date(\"",

D inst/tinytest/test_insert.R => inst/tinytest/test_insert.R +0 -13
@@ 1,13 0,0 @@
expect_equal(insert(1:5, 99, 1), c(99, 1:5))
expect_equal(insert(1:5, 99, 6), c(1:5, 99))
expect_equal(insert(1:5, 99, 3), c(1:2, 99, 3:5))

expect_equal(insert(1:5, 98:99, c(1,5)), c(98, 1:4, 99, 5))
expect_equal(insert(1:3, 101:103, 1:3), c(101,1,102,2,103,3))


expect_equal(insert(letters[1:5], " ", c(2, 4)),
             c("a", " ", "b", "c", " ", "d", "e"))

expect_equal(insert(letters[1:5], c(" ", "Z"), c(2, 4)),
             c("a", " ", "b", "c", "Z", "d", "e"))

M man/backup.Rd => man/backup.Rd +7 -5
@@ 1,5 1,7 @@
\name{backup}
\alias{old_files}
\alias{path8.3}
\alias{backup_filename}
\title{
  Tools for Creating Backups
}


@@ 15,6 17,8 @@
              min.age.monthend = NULL,
              min.age.yearend = NULL,
              full.names = FALSE)
    path8.3(path = ".")
    backup_filename(root, UTC = FALSE, \dots)
}
\arguments{
  \item{min.age}{


@@ 32,16 36,14 @@
  \code{old_files} will look at filenames and then use
  \code{\link[datetimeutils]{guess_datetime}} to extract the date.

  

}
\value{
  a character vector
  for  \code{old_files}, a character vector
}
\author{
  Enrico Schumann
}
%% \seealso{
%%   \code{\link{Extract}}
%% }
\examples{
backup_filename("daily_report.pdf")
}