[R] convert data.frame to parameters

Charles Annis charles.annis at statisticalengineering.com
Mon Oct 7 15:07:52 CEST 2013

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


Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com

-----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

More information about the R-help mailing list