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

functions not working on dataset of subset within a subset [duplicate]

$
0
0

This question already has an answer here:

In R I am attempting to test the mean number of children someone with college education vs someone without college education has from the US census. However I learned there was a heavy skew in the data from age so I meant to restrict age to over 18. However once I would restrict both age and college education level functions would stop working on the data-set (the data set created looks normal). The functions still don't work but I have gotten closer by making the 18> a variable

eighteen<-ACS_2016_CO$NCHILD[ACS_2016_CO$AGE>17]

eighteen[ACS_2016_CO$EDUCD>6]

gives numeric data

eighteen[ACS_2016_CO$EDUCD<7]

gives numeric data

mean(eighteen[ACS_2016_CO$EDUCD<7])

gives N/A

I have tried with sum and length to attempt to cheese it but both functions too give N/A. Is there a quicker way to restrict both the age and education level at once or does anyone know the reason N/A keeps showing up? Thank-You!


Viewing all articles
Browse latest Browse all 201839

Trending Articles



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