similar to: Recoding a variable

Displaying 20 results from an estimated 10000 matches similar to: "Recoding a variable"

2011 Aug 12
2
recode Variable in dependence of values of two other variables
Hi, as an R-beginner, I have a recoding problem and hope you can help me: I am working on a SPSS dataset, which I loaded into R (load("C:/...) I have 2 existing Variables: "ID" and "X" , and one variable to be computed: meanX.dependID (=mean of X for all rows in which ID has the same value) ID = subject ID. Since it is a longitudinal dataset, there are repeated
2013 Sep 21
1
Translating recoding syntax from SPSS to R
Colleagues, I am in the process of learning R. I've been able to import my dataset (from Stata) and do some simple coding. I have now come to coding situation that requires some assistance. This is some code in SPSS that I would like to be able to execute in R: if (race eq 1 and usborn=0) confused=1 . if (race eq 2 and usborn=0) confused=1 . if (race eq 1 and usborn=1) confused=0 . if (race
2009 Oct 10
7
SPSS long variable names
Hello guys I am new to this list and for R too. I am wondering if there is a patch for the SPSS reading code on the foreign package, in order to be able to read long variable names. Right now read.spss() just trunc the names to 8 characters. Or if someone could help me on other way: I have to process everyday a lot of SPSS Syntax Files and Dat files that come from one system that can only export
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
2004 Mar 11
5
recoding variables
Hi, I was hoping someone could help me. I am a graduate student new to using R, and I'm trying to figure out how to recode a continuous variable to make it into an ordinal variable with 3 categories. I literally have no idea how to proceed--could anyone possibly advise me? Please copy me on any responses, as I have just subscribed to the R-help email list but don't know whether the
2008 Jan 22
6
recoding one variable into another - but differently for different cases
Hello, I have 2 variables in my sample Data: Data$A and Data$B Variable Data$A can assume values: 1, 2, 3, and 4. Variable Data$B identifies my cases and can assume values: 1 and 2. I need to recode my variable Data$A into a new variable Data$new such that: People who are Data[Data$B %in% 1, ] are recoded like this: Value on Data$A Value on Data$new 1 +1 2
2011 Feb 13
2
Recoding using the memisc package
Dear All, I am trying to recode a variable using the functions provided by "memisc" package. Actually I am following the examples on page 9-10 of the vignette: -------------------------------------------------------------------------- d.fig <- within(d.fig,{ sev <- recode(sev, 1 -> 0.9, 2 -> 1.0, 3 -> 1.1, 4 ->
2001 Aug 23
2
Missing Values from Spss-Data
Hello, i'm a newbie of the really fantastic "R" , but have some problems to define Missing Values from Spss-Files which i import with the read.spss(data) command ! What should i do to recode i.e. the values 9,99 & 999 to NA. Something like this x <- c(9,99,999,NA) x==NA ...do not what i want, because the data.frame show the values 9,99 & 999 and not NA in this fields ?
2010 Jan 28
1
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 consumer prices and hurt American exports. Do you FAVOR or OPPOSE placing new limits on imports, or haven't you thought much about this? 1. Favor 5. Oppose 8. DK 9. NA; RF 0. Haven't thought much about this I am trying to
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
2005 Aug 23
1
Seeking help with an apparently simple recoding problem
Hello, I have struggled, for longer than I care to admit, with this seemingly simple problem, but I cannot find a solution other than the use of long drawn out ifelse statements. I know there has to be a better way. Here is stripped down version of the situation: I start with: a <- c(1,0,1,0,0,0,0) b <- c(1,1,1,1,0,0,0) c <- c(1,1,0,1,0,0,0) rbind(a,b,c) [,1] [,2] [,3] [,4] [,5]
2010 Jul 23
1
FW: recoding problem
Hi, I am trying to recode the output from a matrix(here is a small snippet of it): HGlt10RawPerc2008[1:20] [1] -5 0 -1 -1 0 2 3 -5 -2 0 2 0 1 -2 3 0 4 1 4 2 Here is the code I am using to recode it: HGBlt10Points2008 = recode(HGlt10RawPerc
2011 Feb 18
3
recoding a data in different way: please help
Dear R users The following question looks simple but I have spend alot of time to solve it. I would highly appeciate your help. I have following dataset from family dataset : Here we have individuals and their two parents and their marker scores (marker1, marker2,....and so on). 0 means that their parent information not available. Individual Parent1 Parent2 mark1 mark2 1 0 0
2013 Jan 25
1
Recoding variables (without recode() )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130125/859c4520/attachment.pl>
2008 May 19
2
recoding data with loops
# I'm new to R and am trying to get the hang of how it handles # dataframes & loops. If anyone can help me with some simple tasks, # I'd be much obliged. # First, i'd like to generate some random data in a dataframe # to efficiently illustrate what I'm up to. # let's say I have six variables as listed below (I really # have hundreds, but a few will illustrate the point). #
2008 Jun 27
4
Recoding
Hi! Given a vector (or a factor within a df),i.e. v1 <- c(1,1,1,2,3,4,1,10,3) and a dictionary cbind(c(1,2,3),c(1001,1002,1003)) is there a function (on the same line than recode() in car) to get v2 as c(1001,1001,1001,1002,1003,4,1001,10,1003) ? I'm using myself a function based on match() since long ago (I think that thanks to advice by Prof. B. Ripley), but would like to know if there
2002 Jan 07
0
Recoding variable levels in R
>From: "Stuart Leask" <stuart.leask at nottingham.ac.uk> > >Hi there. When I wished to recode two variables in SPSS, I could use the >command RECODE: > >recode VAR1 VAR2 VAR3 etc. (1=0) (2=1) (3,MISSING=SYSMIS) (else=0). > >In R, I can 'hand-crank' each variable (using ifelse, or if the data is in a >matrix by logical tests, or no doubt numerous
2004 Jul 03
3
Recoding scores of negatively worded item
Hi, I'm new to R so please fogive if I write someting silly ... I need to recode a series of responses from a number of questionnaires. The data is read via ODBC from a database where all responses are coded as tables of the form (id, question, score). After dealing with recoding of missing values, I need to "invert" the scores of some questionnaire's item in the form x <-
2004 Oct 18
2
Recoding factors
I'm having a bit of trouble recoding factors in a fields. I have a field which has the factors Singleton, Twin and Triplet. I want to recode the field to have only the factors Singleton and Multiple. Any advice? Cheers, Neil
2007 Jun 11
1
Recoding
I want to do some recoding of variables: code Age into groups and recode a factor into a smaller number of levels. There are a couple of options for recode functions, in the car package and in memisc, and I think in gmisc. Does anyone have any opinions on the the easiest, most reliable approach for these problems? David Scott _________________________________________________________________