Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread David Winsemius
On Nov 4, 2011, at 1:50 PM, "Francois Pepin" wrote: > Hi, > > assign is your friend here: > apply(data,1,function(x)assign(x[1],x[2],envir = .GlobalEnv)) > > As a note, you probably don't want to use data as a variable because it > overwrites the data function, leading to unwanted side-effe

Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Francois Pepin
Hi, assign is your friend here: apply(data,1,function(x)assign(x[1],x[2],envir = .GlobalEnv)) As a note, you probably don't want to use data as a variable because it overwrites the data function, leading to unwanted side-effects if you ever use it. Cheers, François Pepin Scientist Sequenta,

Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Eric Lecoutre
Hi, Did you program in SAS previously? :) You don't really want data.frame but a named list (note that data frames are lists but for columns). mypars <- as.list(value) names(mypars) <- param mypars$max_pct If you really want to use data.frame you can assign rownames and access parameters throu

[R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Aher
Hi List, I want to read several parameters from data frame and load them as object into R session, Is there any package or function in R for this?? Here is example param <-c("clust_num", "minsamp_size", "maxsamp_size", "min_pct", "max_pct") value <-c(15, 2, 20, 0.001, .999) data <- d