Re: [R] function in R for my exercise

2012-01-04 Thread Thomthom
Hi Michael, Thanks for your answer! sorry I didn't see this rule... No problem, I'll try to figure it out by myself. Thanks for your indication though! Thomas 2012/1/4, Michael Weylandt [via R] : > > > Unfortunately, there's a general no-homework rule because we never > know what your instructo

Re: [R] function in R for my exercise

2012-01-04 Thread R. Michael Weylandt
Unfortunately, there's a general no-homework rule because we never know what your instructor wants you to figure out on your own (though, a sincere thanks for admitting this was hw rather than trying to trick us like so many). That said, I think your second function, while a little clumsy, does wor

[R] function in R for my exercise

2012-01-04 Thread Thomthom
Hi R helpers! I have a question. I'm trying to create a function for an exercise. Here are the arguments I should include: x and y are numeric z is a name ("plus","minus","multiply","divide") and swap is logical. Here is what the function should do: When z="plus", then x+y is performed and so o