[R] Attempting to recode elements contained in a list

Greg Blevins gblevins at marketsolutionsgroup.com
Thu Aug 25 06:57:03 CEST 2005


Hello R-Masters,

I have a list 's' with three elements, as shown below.  I want to recode a.a,  a.a2, and a.a3 to NA if the value in a.a is less than 3.  

I reivewed my Modern Applied Statistic Book, the online help and did some searching of R-help on the internet. I explored unlist and as.list.data.frame in an attempt to isolate the third element of the list s, but this was not helpful. Any help would be appreciated.

> dim(s)
[1] 342   3
> names(s)
[1] "scan" "time" "a"

> s
                  scan               time a.a a.a2 a.a3
202       Plastic lids       Plastic lids NaN  NaN  NaN
195       Plastic lids      Cookware lids  44   31   58
205       Plastic lids  Seasoning packets   9    4   20
191       Plastic lids      Baking sheets  15    7   27
209       Plastic lids           Utensils   9    4   20
194       Plastic lids        Cell phones   0    0    7
193       Plastic lids       Canned goods   0    0    7
197       Plastic lids    Hand/dish towel   3    0   12

Thank you.

Greg Blevins
The Market Solutions Group

Windows xp, 2.1.1

Gregory L. Blevins
Vice President, Partner
The Market Solutions Group, Inc.
gblevins at marketsolutionsgroup.com
Office phone: 612 392-3163
Cell phone: 612 251-0232
"What is at the beginning but a small error, swells to huge proportions at the close." Aristotle




More information about the R-help mailing list