[R] Writing a function, want a string argument to define the name of the excel sheet to be called

AOLeary aodhanol at gmail.com
Thu Dec 1 14:43:37 CET 2011


My question is this: is there a way I can make one of the arguments of the
function be a string the user can enter, and then have that be the excel
filename? ie,

foo <- function(x,y,NAME){

#make a matrix with x rows and y cols
M <- matrix(nrow=x,ncol=y)
#write the matrix
write.table(M, file = "result.csv",append=TRUE, sep = ",") 
}

I've had a look but I couldn't find help for this particular problem and
it's one I'd like to solve, so I can change make several excel files to
solve the analysis my actual function does.

Thank you very much,
Aodhán

--
View this message in context: http://r.789695.n4.nabble.com/Writing-a-function-want-a-string-argument-to-define-the-name-of-the-excel-sheet-to-be-called-tp4128384p4128384.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list