Click here to Skip to main content
15,742,145 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a 15x15 matrix with strings of "0"s and "1"s. I need to find the number of columns that have only one "0". Note that the variables in the matrix are strings, not numerics

What I have tried:

colSums(m1=="1", na.rm=TRUE)
Maciej Los 15-Mar-22 17:23pm    
And what is wrong with your code?
I'm not R specialist, but this seems to be interesting: Count the number of pattern matches in R dataframe column - DataScience Made Simple[^]

Good luck!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900