Skip to content
Back to formatted view

Raw Message

Message-ID: <OF8337205C.B335F100-ONC12580A4.002F66E2-C12580A4.00307583@lotus.hawesko.de>
Date: 2017-01-10T08:49:19Z
From: G.Maubach at weinwolf.de
Subject: Assessing the name of an object within an argument

Hi All,

I have a function like

my_func <- function(dataset)
{
  some operation
}

Now I would like not only to operate on the dataset (how this is done is 
obvious) but I would like to get the name of the dataset handed over as an 
argument.

Example:

my_func <- function(dataset = iris)
{
  print(dataset)  # here I do not want to print the dataset but the name 
of the object - iris in this case - instead
  # quote() does not do the trick cause it prints "dataset" instead of 
"iris"
  # as.name() gives an error saying that the object can not coerced to a 
symbol
}

Is there a way to do this?

Kind regards

Georg