Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204771

How to make a proportion from a dataset

$
0
0

Basically, my dataset is about the total mysteries that occurred from 2000-2015. There is a column that is literally titled Mystery.Solved and in that column, each one is either "Yes" for yes it has been solved or "No" for no it hasn't been solved.

I'm trying to make a proportion all of the unsolved mysteries that occurred in each year over the total mysteries that occurred in each year (I am gonna end up graphing the result afterward so that's why I want each year's proportion).

I've tried:

unsolved <- subset(mysteries, Mystery.Solved == "No")

total_mysteries <- subset(mysteries, Mystery.Solved == "Yes" | Mystery.Solved == "No")

unsolved / total_mysteries

All this gives me is a huge list (because the dataset is large) all of which return 1 because I assume I'm dividing the same value over the other which is obviously not what I want to do. Any help would be appreciated. Thanks so much! Feel free to comment if you have any inquiries or if I haven't been specific enough in my question.


Viewing all articles
Browse latest Browse all 204771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>