Re: [R] Recoding variables in R

2018-05-23 Thread Lisa van der Burgh
Thank you all for your help, it worked! Op 23 mei 2018 om 19:27 heeft marta azores 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 mailto:lisavdbu...@hotmail.com>>: Hi all, I have a very genera

Re: [R] Recoding variables in R

2018-05-23 Thread Rui Barradas
Hello, See if this inspires you. set.seed(1962) DF <- data.frame(Anxiolytics = factor(sample(c(0, 2, NA), 1000, TRUE), levels = 0:2)) summary(DF$Anxiolytics) DF$Anxiolytics <- droplevels(DF$Anxiolytics) summary(DF$Anxiolytics) DF$Anxiolytics <- factor(DF$Anxiolytics, labels = 0:1) summary(D

Re: [R] Recoding variables in R

2018-05-23 Thread William Dunlap via R-help
It looks like your data has class "factor". If you call factor() on a factor variable, without supplying an explicit 'levels' argument it produces a new factor variable without any levels not present in the input factor. E.g., > fOrig <- factor(c(NA,"A","B","D",NA,"D"), levels=c("D","C","B","A")

[R] Recoding variables in R

2018-05-23 Thread Lisa van der Burgh
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) 01 2

Re: [R] Recoding Variables in R

2010-01-28 Thread John Fox
ary-28-10 10:15 AM > To: r-help@r-project.org > Subject: [R] Recoding Variables in R > > > > VAR 980490 > > Some people have suggested placing new limits on foreign > > imports in order to protect American jobs. Others say > > that such limits would raise cons

[R] Recoding Variables in R

2010-01-28 Thread Mathew, Abraham T
VAR 980490 Some people have suggested placing new limits on foreign imports in order to protect American jobs. Others say that such limits would raise consumer prices and hurt American exports. Do you FAVOR or OPPOSE placing new limits on imports, or haven't you thought much about this?