I am not exactly sure how to write it out, but I will show the code of what I want. I am trying to determine the accuracy of certain people in a task that was conducted on numerous occurrences, however, there is a very large number of cases.
names <- c("James", "James", "James", "James", "James", "John", "John", "Fred")
outcome <- c("successful", "unsuccessful", "unsuccessful", "successful", "successful", "successful",
"unsuccessful", "unsuccessful")
accuracy <- c("60%", "60%", "60%", "60%", "60%", "50%", "50%", "0%")
df <- data.frame(names, outcome, accuracy)
In the above example, I have obviously manually input the data, but I was wondering how to write a code that looks at the frequency of successful/unsuccessful outcomes in relation to the person's name, and then print the percentage of the total instances that were successful in the accuracy column.
I am not really sure where to start with this, and hopefully it is a simple solution that I just didn't think of!
Thanks in advance