Thank you all for your help, it worked! Op 23 mei 2018 om 19:27 heeft marta azores <martazo...@gmail.com<mailto:martazo...@gmail.com>> het volgende geschreven:
Try that code NewDF<-DF[!DF$Anxiolytics==1,] 2018-05-23 10:14 GMT+00:00 Lisa van der Burgh <lisavdbu...@hotmail.com<mailto:lisavdbu...@hotmail.com>>: Hi all, I have a very general question and I think for you maybe very easy, but I am not able to solve it. I have a dataset and that dataset contains the variable Anxiolytics. This variable is coded as 0, 1, 2. The variable looks as follows: > summary(DF$Anxiolytics) 0 1 2 NA's 1102 0 20 440 You can see that the variable is coded as 0, 1, 2, but group 1 is 'empty'. So I want to remove this group, such that I get: > summary(DF$Anxiolytics) 0 2 NA's 1102 20 440 And then I want to recode the variable in a way that 2 becomes 1, such as: > summary(DF$Anxiolytics) 0 1 NA's 1102 20 440 Can you help me with the code for doing this? Thank you in advance! Best, Lisa [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.