Re: [R] write.csv naming file after function argument

2011-10-16 Thread Kristian Lind
Thank you for your help. It works now. 2011/10/13 Jean V Adams > > Kristian Lind wrote on 10/13/2011 04:52:16 AM: > > > > > Dear R-users, > > > > I'm writing a program that constructs a dataset. I wish to save the > dataset > > to a file. > > > > Here's a very simple example of what I'm trying t

Re: [R] write.csv naming file after function argument

2011-10-13 Thread Jean V Adams
Kristian Lind wrote on 10/13/2011 04:52:16 AM: > > Dear R-users, > > I'm writing a program that constructs a dataset. I wish to save the dataset > to a file. > > Here's a very simple example of what I'm trying to do > > function(x=peter){ > y <- x/2 > write.csv(y, file = "...\x") > } > > The

Re: [R] write.csv naming file after function argument

2011-10-13 Thread Ivan Calandra
Hi Kristian, If I understand correctly, you probably want to use paste(): myfun <- function(x=peter){ y <- x/2 filename <- paste(x, ".csv", sep="") write.csv(y, file = filename) } HTH, Ivan Le 10/13/2011 11:52, Kristian Lind a écrit : Dear R-users, I'm writing a program that constructs

[R] write.csv naming file after function argument

2011-10-13 Thread Kristian Lind
Dear R-users, I'm writing a program that constructs a dataset. I wish to save the dataset to a file. Here's a very simple example of what I'm trying to do function(x=peter){ y <- x/2 write.csv(y, file = "...\x") } The problem is that I want to name the dataset as whatever the name of the input