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 through: datapars <- data.frame(value=value) rownames(datapars) <- param datapars["max_pct","value"] But this really seems more complicated way ins't it? HTH Eric On 4 November 2011 07:24, Aher <ajit.a...@cedar-consulting.com> wrote: > 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, 20000, 200000, 0.001, .999) > data <- data.frame ( cbind(param , value)) > data > param value > 1 clust_num 15 > 2 minsamp_size 20000 > 3 maxsamp_size 2e+05 > 4 min_pct 0.001 > 5 max_pct 0.999 > > My data contains many such parameters, I need to read each parameter and > its > value from the data and load it as objects in R session as below: > > clust_num <- 15 > minsamp_size <-20000 > maxsamp_size <-2e+05 > min_pct <-0.001 > max_pct <-0.999 > > The way right now I am doing it is as creating as many variables as > parameters in the data frame and one observation for value of each > parameter. > example: > clust_num minsamp_size maxsamp_size min_pct max_pct > 15 20000 200000 0.001 0.999 > > data$ clust_num , data$minsamp_size, ..... > > Is there any better way for doing this? > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Reading-parameters-from-dataframe-and-loading-as-objects-tp3989150p3989150.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Eric Lecoutre Consultant - Business & Decision Business Intelligence & Customer Intelligence [[alternative HTML version deleted]] ______________________________________________ R-help@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.