doit <- function(data) {
  cat("This function is using values from the data frame",
deparse(substitute(data)), "\n")
}

On Wed, Jan 29, 2014 at 6:48 PM, John Sorkin
<jsor...@grecc.umaryland.edu> wrote:
> I would like to take a parameter passed to a function as a text string. I 
> don't want the parameter evaluated, I want it uses exactly as passed,
>
> doit <- function(data) {
>
> cat("This function is using values from the data frame ",data,"\n")
>
> }
>
> mydata <- data.frame(x = c(1,2,3), y=c(3,2,1))
> doit(mydata)
>
> I would like to see the following printed
>
> This function is using values from the data frame mydata
>
> Thank you,
> John
>
>
>
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and 
> Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:14}}

______________________________________________
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