[R] Selective transformation

Allan Kamau kamauallan at yahoo.com
Tue Aug 21 18:26:47 CEST 2007


I am looking for a way to transform select observations based on a value based criteria.
Why - Am learning r and would like to perform regression analysis of given variables of the babies dataset (part of UsingR) for example babies$wt1, the data in the variables does contain values which should be interpreted as unknown, some variables have 999 for unknown and some have 99 for the same, since lm() expects not available data to be marked using NA.
I would like to use a solution that does not employ loops (I think it may not be the ideal way)

I am looking at using apply() and supply the name of my function responsible for transformation, but am unable to know now to reference the element of the vector/list being currently processed by apply() so I may do in place substitution (if value is 99 or 999) of the value with NA.






       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.



More information about the R-help mailing list