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

R code to categorize age into group/ bins/ breaks

$
0
0

I am trying to categorize age into group so it will not be continuous. I have this code:

data$agegrp(data$age>=40 & data$age<=49) <- 3
data$agegrp(data$age>=30 & data$age<=39) <- 2
data$agegrp(data$age>=20 & data$age<=29) <- 1

the above code is not working under survival package. It's giving me:

invalid function in complex assignment

Can you point me where the error is? data is the dataframe I am using.


Viewing all articles
Browse latest Browse all 201945

Trending Articles



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