Hello R users,
I am relatively new to R and cannot seem to crack a coding problem. I
am working with substance abuse data, and I have a variable called
primary.drug which is considered the drug of choice for each
subject. I have just a few missing values on that variable. Instead
of using
Here's an example of how I think you can do what you want. Play with
the definition of the function highest.use() to get random selection of
multiple maxima.
drug.names - c(marijuana, crack, cocaine, heroin)
drugs - factor(drug.names, levels=drug.names)
drugs
[1] marijuana crack