[R] Results with name of dataset

Michael Bedward michael.bedward at gmail.com
Mon Aug 9 11:43:09 CEST 2010


On 9 August 2010 19:30, Evgenia <evgts at aueb.gr> wrote:
>
> Function ex works fine BUT I don't want the file of results to have the name
> "data Example" but
> "exampledata_9810 Example"
> How can I do this?

Do you mean that you want the filename to be based on the name of the
object passed to the function ?  If so, try this...

ex<-function(data) {
  sink(paste(deparse(substitute(data)), ' Example.txt'))
  print(summary(data))
}

Michael



More information about the R-help mailing list