I have this data and I want to figure out a way to know how many ones and how many zeros are in each column (ie Arts and Crafts). I have been trying different things but it hasn't been working. Does anyone have any suggestions?
Asked
Active
Viewed 549 times
0
-
Try `table(myData[, "myColumn"])` – zx8754 Sep 02 '21 at 20:01
-
If you want to count the number of occurrences row vice. You can find the answer here: https://stackoverflow.com/questions/24015557/count-occurrences-of-value-in-a-set-of-variables-in-r-per-row – INDRAJITH EKANAYAKE Sep 02 '21 at 20:14
1 Answers
0
You can use the table()
function in R. This creates a categorical representation of your data. Additionally here convert list to vector I have used unlist()
function.
df1 <- read.csv("Your_CSV_file_name_here.csv")
table(unlist(df1$ArtsAndCrafts))
If you want to row vice categorize the number of zeros and ones you can refer to this question in Stackoverflow.

INDRAJITH EKANAYAKE
- 3,894
- 11
- 41
- 63