I generate and save a dataset
For example
exampledata<-runif(10)
library("R.utils");
saveObject(exampledata, file="exampledata_9810.RData");
exampledata_9810<- loadObject("exampledata_9810.RData");
I use ex function to make alot of calculations using sink to export results
(in this simply example only summary of dataset)
ex<-function(data){
sink(paste("data",'Example.txt'))
print(summary(data))
}
ex(data=exampledata_9810)
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?
Thanks for your help
Evgenia
--
View this message in context:
http://r.789695.n4.nabble.com/Results-with-name-of-dataset-tp2318328p2318328.html
Sent from the R help mailing list archive at Nabble.com.
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