Dear,


I am using R I'm trying to identify and remove columns and rows in a data
frame that are has elements equals. For example in dataframe below. The
columns 1, 2,3,4,5 ,6 and 10 (file1) has elements equal then should be
removed. How can I ask R to remove those columns with same elements in new
dataframe (file2) to result a matrix as follows:



file1

1  0  2  2  1  1  5  1  1  1

1  0  2  2  1  1  5  1  1  1

1  0  2  2  1  2  5  2  2  1

1  0  2  2  1 1  5  1   1  1

1  0 2  2  1  0  5  0  2  1

1  0  2 2  1  1  5  1  0  1



file2

1   1  1

1   1  1

2   2  2

1   1  1

0   0  2

1   1  0



After I need to know which ones names of columns are remove = 1, 2,3,4,5 ,6
and 10.



Similarly this is I need to check for rows in file2. To remove rows and
identify all that elements equal.

The final dataframe is:



file3



0   0  2

1   1  0



row names removed = 1,2,3 and



Thanks and Regards

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to