Skip to content
Prev 157544 / 398506 Next

How to remove columns of table in R recursively

On Tue, 30-Sep-2008 at 12:37AM +1000, Jason Lee wrote:
|> Hi R-list,
|> 
|> I would like to know how to perform any elimination of attribute (column) in
|> R.
|> 
|> E.g I  have:-
|> 
|> 20,21,22,23,24,25,normal
|> 1,2,3,4,5,5,normal
|> 0,1,0,2,3,4,abnormal
|> ...
|> 
|> I intend to do a checking on each column:-
|> 
|> If the column sum of abnormal is 0 but the column sum of normal is nonzero,
|> i wanted to eliminate this attribute. And so on and so forth observing other
|> attributes across the list. In the end, I wanted to form information as a
|> table.
|> 
|> Desired Output:-
|> 21,23,24,25,normal
|> 2,4,5,5,normal
|> 1,2,3,4,abnormal
|> 
|> It is some sort of removing noise from the data.

Is this the sort of thing you want to do?
A  B C
1 1 12 0
2 2 11 4
3 3 10 3
4 4  9 0
5 5  8 1
A  B C
2 2 11 4
3 3 10 3
5 5  8 1