[R] convert data.frame to parameters

Bert Gunter gunter.berton at gene.com
Mon Oct 7 15:36:52 CEST 2013


1. ?assign is what you're looking for, I think.

2. But I would guess that you do not need to do this. As a further
guess, see ?do.call for creating a function call that you can give a
list of arguments/parameters.

Cheers,
Bert

On Mon, Oct 7, 2013 at 6:07 AM, Charles Annis
<charles.annis at statisticalengineering.com> wrote:
> Sorry for using "parameters" when I meant "objects."  I also wasn't
> sufficiently clear about what I'm trying to do.
>
> Your suggestion produces a single object, "parameters."  What I want are 26
> objects, a , b, c, ... whose values are df$values, which in my case are
> numeric.
>
> Thanks.
>
> Charles Annis, P.E.
>
> Charles.Annis at StatisticalEngineering.com
> http://StatisticalEngineering.com
> 561-352-9699
>
> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
> Sent: Monday, October 7, 2013 8:04 AM
> To: Charles Annis
> Cc: r-help at r-project.org
> Subject: Re: [R] convert data.frame to parameters
>
> On 07/10/2013 7:56 AM, Charles Annis wrote:
>> Greetings:
>>
>> I have a 24 row,  2-column csv file.  The first column is character,
>> with the names of parameters.  The second column is numeric,
>> containing the parameter values.
>>
>> I can produce a 2-column data.frame with  case.study.parameters <-
>> read.csv(...)
>>
>> I want to convert the data.frame to 24 parameters having those names
>> and their associated numeric values.
>>
>> I've tried using package "ParamHelpers" with no success.  Likely
>> because it really isn't intended for that purpose.
>>
>> Can anyone help?
>
> You say you want "parameters", but that's not an R type.  So here's one way,
> but it might not be what you're looking for.
>
> df <- data.frame(names=letters, values=1:26) parameters <- df$values
> names(parameters) <- df$names
>
> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

(650) 467-7374



More information about the R-help mailing list