In R i perform calculation. With the functions i count the number of "Males" But in my dataset I also have "Female" As a job I also five other categories for instance "Nurse"
This is my code
a=sum(mydata$gender == "Male")
b=sum(mydata$job == "Doctor" & mydata$gender == "Male")
ab=b/a
I want to have a function that makes it possible to replace for instance mydata$gender == "Male" with mydata$gender == "a" where "a" is a function that ask me to pick the type of variable that i want. For instance in the gender the R console ask me in mydata$gender to select Female based on the categories in mydata$gender
And then in mydata$job == "b" the R console asks me to pick nurse or cleaner or director based on the categories in the variable job
Is this possible or do you guys know something that looks like this.
Example of dataset:
- ID, job, gender, day of birth 1, Doctor, Male, 23-04-1980
- 2, Doctor, Female, 23-04-1985
- 3, Nurse, Female, 23-04-1983
- 4, Cleaner, Male, 23-04-1982
- 5, Director, Male, 23-04-1986
shinywas created to provide rich HTML interfaces to R programs. Perhaps that's something you might be interested in. - MrFlick