I am pretty new with R (R studio user), but more and more enthousiastic.
I imported an Excel file in R (R studio). No problem. Big file with 29 columns and 14.000 rows. One column contains only two possible values: S or E.
What I did (after trying a lot of other coding) is: I took the column out of the dataset:
kolom <- data1$spoedelectief
# this worked wel. Pretty long view...:
> View(kolom)
#then I wrote this. Worked good as well.
> length(which(kolom == "S"))
[1] 1999
#and the same code counted the amount of E as well.
> length(which(kolom == "E"))
[1] 11322
I found examples that show how to count NA in a column / dataset. Found some other coding, but nothing seems to work (or is it me...). My question: the code as shown works. But I guess there is a method to count directly in my dataframe of 29 colums and all those rows.
dataframe name is data1. Column: spoedelectief. What code can I use to directly count the E or S on that column?