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

Table % categorical variable from different subsets

$
0
0

I have a dataset with 15 metrics (columns) from a csv. 1 metric is called Cancer

This is what the column in the dataset looks like

Cancer:  yes no yes no

I would like to create a table with the percentages Cancer Yes No But I am making different subsets (e.g filtered dataset 1: agegroup 50-54 and numberrelatives=1, filtered dataset 2: agebirtfirstchild <30, breastdensity:extremely dense) I would like to make 1 table with the percentages cancer yes/no with all the different subsets

example dataset:

`cancer = c("yes", "no") 
 agegroup = c("35-39", "40-44") 
 numberrelatives = c("zero", "one") 
 agefirstchild = c("Age < 30", "Age 30 or greater") 
 df = data.frame(cancer, agegroup, numberrelatives, agefirstchild)`

Viewing all articles
Browse latest Browse all 201839

Trending Articles



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