R/Command.R

Defines functions Q Command

Documented in Command Q

Command <- function(fun, ..., to){
  args <- list(...)
  arg.names <- names(args)
  used <- !(is.na(args) | 
                trim.blanks(args) == "" | 
                trim.blanks(args) == "NA" | 
                trim.blanks(args) == "NULL" | 
                sapply(args, is.null))
  arg.names <- arg.names[used]
  args <- args[used]
  arg.names <- ifelse(arg.names == "", "", paste(arg.names, "= "))
  command <- paste0(fun, "(", paste(paste0(arg.names, args), collapse=", "), ")")
  if (!missing(to)) command <- paste(to, "<-", command)
  command
}

Q <- function(string) paste0('"', as.character(string), '"')

Try the Rcmdr package in your browser

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

Rcmdr documentation built on Sept. 28, 2023, 5:08 p.m.