splice_in_col_name: Splice column name into vector of column names

View source: R/splice_in_col_name.R

splice_in_col_nameR Documentation

Splice column name into vector of column names

Description

Splice column name into vector of column names

Usage

splice_in_col_name(col_names, new_name)

Arguments

col_names

A length-one character vector of a header line from a DSSAT format output file

new_name

A length-one character vector that contains a column name suspected to be a substring of one of the existing elements of the col_names vector.

Value

If new_name matches a substring, the function will return a new character vector with it spliced into the existing col_names in the position immediately before the element that contained the matching substring. Otherwise the original col_names will be returned.

Examples


cnames <-
  c("@VAR#","VAR-NAME........","EXPNO","ECO#","TB(1)TO1(1)TO2(1)","TM(1)")

DSSAT:::splice_in_col_name(cnames,"TB(1)")

DSSAT documentation built on Nov. 9, 2023, 1:08 a.m.