[R] paste argument of a function as a file name
Frede Aakmann Tøgersen
FredeA.Togersen at agrsci.dk
Thu Nov 10 14:57:02 CET 2005
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: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] På vegne af Luis Ridao Cruz
> Sendt: 10. november 2005 14:28
> Til: r-help at stat.math.ethz.ch
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list