I am a little bit rusty in R, and appreciate if you could help me.
I have a dataframe that I need to get some stats from it. The data frame (in a simpler way) looks like this:
df <- data.frame(tech=c("Leonardo", "Leonardo", "Leonardo", "John", "John", "John", "Will", "Will", "Will", "Bob"),
type=c("V", "P", "V", "V", "P", "V", "V", "P", "V", "V"),
breed=c("A", "A", "A", "B", "B", "B", "C", "C", "A", "B"),
central=c("J", "J", "K", "J", "K", "J", "K", "K", "K", "J")
I need to get the percentage of "type" by each technician in another dataframe. And then other daframe containg the percentage of "type" by each technician by breed. (ex: If a technician has only one type (either V or P), it would reflect in 100%)
I have seen other topics where the user wanted to get similar information (Summarizing by subgroup percentage in R) but they had a numerical value to get this percentage. In my case, I have V or P. I imagine it's the same way of thinking but I tried the suggested solution on the other post and it's not working in my case.
Is there a simple way of doing this? I appreciate your help