[R] Creating objects from values in a "meta" dataframe

Spencer Graves spencer.graves at pdf.com
Fri Apr 25 16:24:10 CEST 2003


 From what I read of your problem statement, there should be a solution 
along the lines you outlined.  Could you cut down the problem still 
further and give us an example of something you've done that did NOT 
work, so we can see how it did not work.

hth.  spencer graves

Bashir Saghir (Aztek Global) wrote:
> I am trying to use a meta data set with information about some repetative
> analysis that I have to do for a variables measured on multiple occasions. 
> 
> I think the best way to explain the problem is by using a simplified
> example. So here goes:
> 
> I have a data frame called "meta" say with the following content:
> 
> Test  Min  Max  Low  High
> APS    0    40  -10   10
> TPP    0   120   -8    8
> NOS    0    25  -15   12
> ... etc ...
> 
> I want to create an object based on each of the Test names, for example:
> 
> cADS <- function(ADS1, min=0, max=40; low=-10, high=10)
> cTPP <- function(TPP1, 0, 120, -8, 8)
> cNOS <- function(NOS1, 0, 25, -15, 12)
> .. etc ...
> 
> where ADS1, TPP1, NOS1, etc. are columns from a second data frame, say,
> "study".
> 
> So in summary how do I create a variable based on the entries in "meta"
> (e.g. from 'APS' I want to create 'cAPS') using a column in another data
> frame again based on the entry in "meta" (eg, ADS0, ADS12, etc...).
> 
> I hope that this explains my problem clearly, if not please let me know.
> 
> Thanks for your help in advance,
> Saghir
> 
> 
> Before I get flamed for what might be a simple solution to a previously
> discussed problem on this list or addressed in the FAQs, I have tried
> extensively (for 3 days now!!!!) to find a solution myself. None of my
> colleagues can help as I am their "R help" most of the time!!! I have tried
> various helps terms on google with and without "r-help", looked at various
> Splus books, and I even looked at all the functions on HTML version of R
> help - I still have no idea what I am looking for. In the past I have
> succeed in doing such things in Stata and SAS. 
> 
> 
> 
> 
> --------------------------------------------------------- 
> Legal Notice: This electronic mail and its attachments are inten... {{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list