Why not use something like

MY.function <- function(x){
  filn <- deparse(substitute(x))
  filename <- paste(filn,"xls",sep=".")
  ...
  ...
  write.table(x,file=filename)
}


Med venlig hilsen
Frede Aakmann Tøgersen
 

 

> -----Oprindelig meddelelse-----
> Fra: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] På vegne af Luis Ridao Cruz
> Sendt: 10. november 2005 14:28
> Til: [email protected]
> Emne: [R] paste argument of a function as a file name
> 
> R-help,
> 
> I have a function which is exporting the output to a file via 
> write.table(df, file =  "file name.xls" )
> 
> What I want is to paste the file name (above) by taking the 
> argument to the function as a file name 
> 
> something like this:
> 
> MY.function<- function(df)
> {
> ...
> ...
> write.table(df,"argument.xls")
> }
> MY.function(argument)
> 
> 
> Thank you
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to