[R] how to define a function in R

Peter Ehlers ehlers at ucalgary.ca
Wed Jul 7 18:10:05 CEST 2010


Chapter 10 of 'An Introduction to R' has the
suggestive title "Writing your own functions".

Isn't that the *first* place you would look?

   -Peter Ehlers

On 2010-07-06 20:57, jd6688 wrote:
>
> Thanks Joshua for the example which has been great help me to start.
>
> Wish you the best
> Jason Ding
>
> On Tue, Jul 6, 2010 at 9:23 PM, Joshua Wiley-2 [via R]<
> ml-node+2280373-448579502-312346 at n4.nabble.com<ml-node%2B2280373-448579502-312346 at n4.nabble.com>
>> wrote:
>
>> Hello,
>>
>> As others have said, its hard to give specific advice without specific
>> needs, but that's okay; I made up some examples needs and some (rather
>> silly) code that might handle it.  Depending what you need to do, it
>> may help you get started.  I tried to explicitly name all the
>> arguments in any functions I used.
>>
>> When I make gmail use basic text format instead of html, code is sent
>> poorly, so you can trundle off here to see the example, if you like.
>>
>> http://gist.github.com/466164
>>
>> Cheers,
>>
>> Josh
>>
>> On Tue, Jul 6, 2010 at 3:48 PM, jd6688<[hidden email]<http://user/SendEmail.jtp?type=node&node=2280373&i=0>>
>> wrote:
>>
>>>
>>> 1. how to write a R script?
>>> 2.How to write a SAS like macro/generic process to process multiple files
>> by
>>> using the same funstion in R?
>>>
>>> Thanks in advance
>>> --
>>> View this message in context:
>> http://r.789695.n4.nabble.com/how-to-define-a-function-in-R-tp2280290p2280290.html<http://r.789695.n4.nabble.com/how-to-define-a-function-in-R-tp2280290p2280290.html?by-user=t>
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________________________
>>> [hidden email]<http://user/SendEmail.jtp?type=node&node=2280373&i=1>mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> University of California, Los Angeles
>> http://www.joshuawiley.com/
>>
>> ______________________________________________
>> [hidden email]<http://user/SendEmail.jtp?type=node&node=2280373&i=2>mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>



More information about the R-help mailing list