R/make.fdt.format.classes.R

make.fdt.format.classes <- function (x,
                                     right,
                                     pattern)
{
  tmp <- strsplit(x,
                  ',')

  res <- lapply(tmp,
                function (.vals) {
                  .vals[1L] <- sprintf(ifelse(right,
                                              paste('(',
                                                    pattern,
                                                    sep=''),
                                              paste('[', 
                                                    pattern,
                                                    sep='')),
                                       as.numeric(substring(.vals[1L], 2)))
                  .vals[2L] <- sprintf(ifelse (right,
                                               paste(pattern,
                                                     ']',
                                                     sep=''),
                                               paste(pattern,
                                                     ')',
                                                     sep='')),
                                       as.numeric(substring(.vals[2L], 1,
                                                            nchar(.vals[2L]) - 1)))
                  paste(.vals, 
                        collapse=', ')
                })

  invisible(unlist(res))
}

Try the fdth package in your browser

Any scripts or data that you put into this service are public.

fdth documentation built on Nov. 18, 2023, 1:08 a.m.