Hi, every R user,

   I wanna output  names of objects, I googled codes from website, but it
was not what I wanted.

the codes are as following:

f <- function (...)
{
  unevaluatedArgs <- substitute(...())
  evaluatedArgs <- list(...)
  stopifnot(length(unevaluatedArgs) == length(evaluatedArgs))
  tags <- vapply(unevaluatedArgs, FUN=function(x) deparse(x)[1],
                 FUN.VALUE=character(1))
  if (!is.null(tmp <- names(evaluatedArgs))) {
    # if argument is tagged, tag=expr, use the tag
    i <- !is.na(tmp) & tmp != ""
    tags[i] <- tmp[i]
  }
  tags
}

f(a1=log(1:4), m1=1:4, c1=pi)

results:

> f(a1=log(1:4), m1=1:4, c1=pi)
  a1   m1   c1
"a1" "m1" "c1"


what I wanted is outputting "log(1:4) " "1:4", "pi" , while not "a1" "m1"
"c1" .

Coulde someone tell me how to get the results I wanted?

Thanks.

Yuanzhen Lin

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to