Re: [R] formals or args question

From: BJ <erithid_at_bellsouth.net>
Date: Tue 24 May 2005 - 00:59:59 EST

Ahh. Thanks a lot! works great. :-p

Ales Ziberna wrote:

> names(formals(fun))
>
> You need the names of the elements of the list formals produces, not
> their content!
>
> Ales Ziberna
>
> ----- Original Message ----- From: "BJ" <erithid@bellsouth.net>
> To: <r-help@stat.math.ethz.ch>
> Sent: Monday, May 23, 2005 4:45 PM
> Subject: [R] formals or args question
>
>
>> Hello again, thank you again for all of your help. I am trying to get
>> the
>> arguments for a function, in a way that I can handle them. If I do
>> args(fun), it doesnt really do what I want. If I use formals(fun) i get
>> output like:
>>
>> $a
>>
>>
>> $r
>>
>>
>> $s
>>
>>
>> Now, lthis is supposedly a list, but if i say formals(a)[[1]], I get
>> nothing. I am just trying to get a vector with teh arguments of a
>> function so I can loop over them.
>>
>> ex; a<-function(p,r){p+r}
>>
>> want: vector of c("p", "r")
>>
>> The documentation for args and formals is quite confusing. Thanks again!
>> ~Erithid
>>
>> ______________________________________________
>> R-help@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
>>
>>
>
>



R-help@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 Received on Tue May 24 01:03:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:00 EST