[R] Attempting to recode elements contained in a list

From: Greg Blevins <gblevins_at_marketsolutionsgroup.com>
Date: Thu 25 Aug 2005 - 14:57:03 EST


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@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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 25 15:03:37 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:55 EST