search for: recodes

Displaying 20 results from an estimated 700 matches for "recodes".

Did you mean: recode
2009 Apr 01
4
Recode of text variables
Hi all I am trying to do a simple recode which I am stumbling on. I figure there must be any easy way but haven't come across it. Given data of A","B","C","D","E","A" it would be nice to recode this into say three categories ie A and B becomes "Treat1", C becomes "Treat 2" and E becomes "Treat 3". I tried
2012 Nov 09
5
using lapply with recode
Hello: Forgive me, this is surely a simple question but I can't figure it out, having consulted the help archives and "Data Manipulation With R" (Spector). I have a list of 11 data frames with one common variable in each (prov). I'd like to use lapply to go through and recode one particular level of that common variable. I can get the recode to work, but it only returns the
2005 Jul 28
1
Unexpected behavior in recode{car}
Thanks to the R creators for such a great statistical system. Thanks to the R help list, I have (finally) gotten far enough in R to have a question I hope to be worth posting. I'm using the recode function from John Fox's car package and have encountered some unexpected behavior. Consider the following example: ## Begin cut-and-paste example require( car ) set.seed(12345) nn <-
2010 Jun 15
1
Problem with the recode function
Hello, I am using the recode() function in Rcmdr and the result is not what I expect so I am almost sure I did something wrong but what... > test <- data.frame(x=1:10) > library(car) > recode(test$x,'1:5=0 ; else=1', as.factor.result=TRUE) [1] 0 0 0 0 0 1 1 1 1 1 Levels: 0 1 BUT > library(Rcmdr) # recode from the car package is now masked Now I recode test$x
2008 May 28
1
manipulating multiply imputed data sets
Hi folks, I have five imputed data sets and would like to apply the same recoding routines to each. I could do this sort of thing pretty easily in Stata using MIM, but I've decided to go cold turkey on other stats packages as a incentive for learning more about R. Most of the recoding is for nominal variables, like race, religion, urbanicity, and the like. So, for example, to recode race
2008 Mar 18
1
Updating selected variables in a data frame
...ke to update certain rows/columns in a data frame with new values. The application is that survey respondents may give an answer of "Other" to a categorical question and then provide some text describing what they mean. This text is then reviewed and placed into a category. These edits or recodes then need to be merged back into the main dataset. A small example follows. # Generate a main data set (10 people, 2 questions) main <- data.frame(id=1:10, q1=sample(1:5, size=10, replace=TRUE), q2=sample(1:5, size=10, replace=TRUE)) # Generate a corresp...
2010 Apr 07
2
recoding variables-recode not working
Hi, I have numerical variable that I want to recode into categories '0' and '1 and more' and do analysis with that data. I have tried various of possibilities to do so, but I am sucked and nothing is working. recode(Q12, "0='A';1:30='B'") cut(Q12, breaks=c(0,1,30), lables=c('0', '1 and more')) cat(Q12, "0=0;1-33=1") What should
2003 Dec 06
1
recode{car} does not work as expected?
Hi to all, I am having a problem when using recode from the car package. I have a variable that is char and when I use recode to create a new variable that is supposed to be numeric I get a factor variable. Here is the code I am using: > FCI$PRE1 <- recode (PRE1RES, " c('C', 'c')=1 ; else = 0 ; as.factor.result=FALSE ") So, if I understand correctly the recode
2003 Nov 04
2
line breaks in recode
Dear all, it seems to be that 'recode' can't handle any line breaks in its code. The following command causes no problem: datameta$smpid.r <- recode(datameta$smpid,"c(101,25,167,45,75)=25;c(104,51)=51") But if I type ... datameta$smpid.r <-recode(datameta$smpid, "c(101,25,167,45,75)=25; c(104,51)=51") ... the result is a syntax error.
2010 Apr 14
3
Problem with recode -Error in parse(text = range[[1]][1]) : unexpected end of input in " c(0"
Dear colleagues, in the help archive there was a previous person who encountered a problem with the "recode" command in the car library. I'm not sure if that was solved, there was no posting to that effect, but I'm having the same problem. I'm trying to recode a numeric variable with values from 0-100 into a binary variable with values (0,1). The following command:
2008 Jan 07
1
recode() function results in logical output, not factor output
Dear R Users: I have race-ethnicity groups identified in the factor variable Ethnic_G. I need to collapse Ethnic_G into a new variable with only two factors, 1 (White, non-Hispanic) and 2 (Minority). As seen in the code and output below, the recoded race-ethnicity variable is put into logical format, not factor format. I've used library(car) and the package was updated. Any ideas on
2013 May 07
2
recode categorial vars into binary data
Dear R-List, I would like to recode categorial variables into binary data, so that all values above median are coded 1 and all values below 0, separating each var into two equally large groups (e.g. good performers = 0 vs. bad performers =1). I have not succeeded so far in finding a nice solution to do that in R. I thought there might be a better way than ordering each column and recoding the
2013 May 07
2
recode categorial vars into binary data
Dear R-List, I would like to recode categorial variables into binary data, so that all values above median are coded 1 and all values below 0, separating each var into two equally large groups (e.g. good performers = 0 vs. bad performers =1). I have not succeeded so far in finding a nice solution to do that in R. I thought there might be a better way than ordering each column and recoding the
2008 May 17
1
Recode
Hi! Using recode in cars package, I tryed to use the following: recode(data$nrcomp, "lo:5='0 to 5'; 5:hi='bigger than 5'") I got: Erro em parse(text = strsplit(term, "=")[[1]][2]) : unexpected end of input in "'0 to 5" When I try only numbers, or only text, it's ok, but when I try to combine numbers and text, I got a error... Any help?
2009 Nov 18
2
recode according to old levels
Dear R-users, i try to recode a factor according to old levels F <- factor(sample(c(rep("A", 4), rep("B",2), rep("C",5)))) recode(F, "levels(F)[c(1,3)]='X'; else='Y'") i tried to work with eval or expression around levels(F)[c(1,3)], but nothing seems to work. Many thanks if anyone could tell me what i've missed and what's
2008 Mar 27
1
Recode factors
I know this comes up, but I didn't see my exact issue in the archives. I have variables in a dataframe that need to be recoded. Here is what I'm dealing with I have a factor called aa > class(aa) [1] "factor" > table(aa) aa * 0 1 2 3 A B C D L N T 0 0 1908 725 2089 0 0 67 0 0 2 1 6 I need to recode
2006 Jul 02
2
how to recode in my dataset?
Dear Rusers, My question is about "recode variables". First, i'd like to say something about the idea of recoding: My dataset have three variables:type,soiltem and airtem,which means grass type, soil temperature and air temperature. As we all known, the change of air temperature is greater than soil temperature,so the values in those two different temperaturemay represent different
2009 Jun 12
2
Sweave recode(car) and Lyx, compiling but not executing on Mac
I am just beginning to use Sweave with Lyx on a Mac (R2.8.1). I have 12 chunks of Sweave code that work fine, but this piece: <<>>= library(car)
2012 Jul 24
3
package memisc: recode examples
Dear people, Yesterday I looked at the recode command in the memisc package and ran the following example stated in the manual: x <- as.item(sample(1:6,20,replace=TRUE), labels=c( a=1, b=2, c=3, d=4, e=5, f=6)) print(x) f <- as.factor(x) f recode(f,
2011 Jul 29
1
Apostrophes in R Commander in recode
Dear colleagues, I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander. The application cannot deal with apostrpohes ( ' ) do not. I've got a factor from the 2008 Canada Election study (highest level of schooling) and some of the values include "Bachelor's Degree" , "Master's Degree". I've