Ron Crump wrote:
> Hi,
>
> I have a dataframe that contains pedigree information;
> that is individual, sire and dam identities as separate
> columns. It also has date of birth.
>
> These identifiers are not numeric, or not sequential.
>
> Obviously, an identifier can appear in one or two column
Ron Crump wrote:
> Hi,
>
> I have a dataframe that contains pedigree information;
> that is individual, sire and dam identities as separate
> columns. It also has date of birth.
>
> These identifiers are not numeric, or not sequential.
>
> Obviously, an identifier can appear in one or two colu
Hi,
I have a dataframe that contains pedigree information;
that is individual, sire and dam identities as separate
columns. It also has date of birth.
These identifiers are not numeric, or not sequential.
Obviously, an identifier can appear in one or two columns,
depending on whether it was a pa
I've used the one in car with no problems. For grouping a continuous
variable you might also consider cut.
On 11/06/07, David Scott <[EMAIL PROTECTED]> wrote:
>
> 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 c
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 approac
Hi,
I suppose you wouldn't mind rearranging rows in your dataframe. So just
use order() to sort your dataframe according to category (first) and
points (second). Now add a new column with values
(3,2,1,0,...,0,3,2,1,0...etc.) You can construct such vector using by()
or a simple for-loop. Ther
Hi R-users,
I have a data frame like this:
photographer category picture points
Hannu kalat limamikko 1
Teemu kalat verkkovaja 3
Hate kalat munat puoliks padassa 6
Hannu kalat isokala 8
Teemu kasvit, sienet ja muut eliöt harppi 2
Hate kasvit, sienet ja muut eliöt pyynikki 2
Petteri kasvit, siene
ED] On Behalf Of Murray
>> Jorgensen
>> Sent: Wednesday, October 25, 2006 7:13 PM
>> To: r-help@stat.math.ethz.ch
>> Subject: [R] Recoding categorical variables
>>
>> I want to recode an integer-valued variable y so that its
>> values become 1:length(y).
nal Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Murray
> Jorgensen
> Sent: Wednesday, October 25, 2006 7:13 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Recoding categorical variables
>
> I want to recode an integer-valued variable y s
I want to recode an integer-valued variable y so that its values become
1:length(y). I can do this using a loop but maybe someone can suggest
code without a loop. My code is this:
y <- round(20*runif(25))
table(y)
suy <- sort(unique(y))
m <- length(suy)
z <- y + max(suy)
for(i in 1:m) z[y==suy[i
rosjean
> Cc: r-help@stat.math.ethz.ch; Denis Chabot
> Subject: Re: [R] recoding large number of categories (select in SAS)
>
> Philippe Grosjean <[EMAIL PROTECTED]> writes:
>
> > Does
> >
> > > ?cut
> >
> > answers to your question?
>
>
Philippe Grosjean <[EMAIL PROTECTED]> writes:
> Does
>
> > ?cut
>
> answers to your question?
That's one way, but it tends to get messy to get the names right.
You might consider using the rather little-known variant of levels
assignment:
preyGR <- prey # or factor(prey) if it wasn't one alr
To:
r-help@stat.math.ethz.ch
.net> cc:
Sent
Does
> ?cut
answers to your question?
Best,
Philippe Grosjean
..<°}))><
) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
) ) ) ) ) Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (
Hi,
I have data on stomach contents. Possible prey species are in the
hundreds, so a list of prey codes has been in used in many labs doing
this kind of work.
When comes time to do analyses on these data one often wants to regroup
prey in broader categories, especially for rare prey.
In SAS yo
See ?levels. I think you want something like the following:
levels(myfact) <- c("Singleton", "Multiple", "Multiple")
Neil Leonard wrote:
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
Yes that's it.
Thanks
Neil
On 18/10/2004, at 7:57 PM, Prof Brian Ripley wrote:
On Mon, 18 Oct 2004, Uwe Ligges wrote:
Neil Leonard wrote:
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 on
On Mon, 18 Oct 2004, Uwe Ligges wrote:
> Neil Leonard wrote:
>
> > 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 advi
I want Twin and Triplet to both be recoded as Multiple
Neil
On 18/10/2004, at 7:43 PM, Uwe Ligges wrote:
Neil Leonard wrote:
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 factor
Neil Leonard wrote:
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?
Depends on what you are going to do with the Twin ...
Uwe Ligges
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
__
[EMAIL PROTECTED] mailing
On Sat, Jul 03, 2004 at 12:17:11PM -0400, Jonathan Baron wrote:
> >b) why there is a different behavior from the command line and from a
> >script?
>
> Could the problem be on the line before the one that gives the error?
I guess I discovered what was the issue ( I knew it was something silly)
I
Jonathan Baron psych.upenn.edu> writes:
: ces$score <- ifelse(ces$question %in% c(1,3,5),5-ces$score,ces$score)
One minor improvement in readability might be:
ces$score <- with(ces, ifelse(question %in% c(1,3,5), 5-score, score))
__
[EMAIL PROTECTED
On 07/03/04 16:45, [EMAIL PROTECTED] wrote:
>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,
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 val
\ ) email: [EMAIL PROTECTED]
) ) ) ) ) SciViews project coordinator (http://www.sciviews.org)
( ( ( ( (
...
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Jonathan Baron
Sent: Tuesday, 08 Ju
On 06/07/04 22:45, Jonathan Baron should have written:
>for (i in [whatever]) Y[i,][X[i,]] <- 1
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-gui
On 06/07/04 21:28, Greg Blevins wrote:
>Hello R folks.
>
>1) The question that generated the data, which I call Qx:
>Which of the following 5 items have you performed in the past month? (multipe
>response)
>
>2) How the data is coded in my current dataframe:
>The first item that a person selected
Hello R folks.
1) The question that generated the data, which I call Qx:
Which of the following 5 items have you performed in the past month? (multipe
response)
2) How the data is coded in my current dataframe:
The first item that a person selected is coded under a field called Qxfirst; the
se
Hi!
> 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.
You are looking for cut():
> a <- runif(15)
> a
[1] 0.19109987 0.78808597 0.78458256 0.31355035 0.02076274 0.82287287 0.75260382
0.82627690 0.14775
(tst <- cut(1:11, c(-Inf, 3, 5, Inf)))
[1] (-Inf,3] (-Inf,3] (-Inf,3] (3,5](3,5](5,Inf] (5,Inf] (5,Inf]
[9] (5,Inf] (5,Inf] (5,Inf]
Levels: (-Inf,3] (3,5] (5,Inf]
>
> class(tst)
[1] "factor"
hope this helps. spencer graves
Shayna Strom wrote:
Hi,
I was hoping someone could help
Shayna Strom wrote:
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?
Basically, you want to use cut(). For example,
x <- 1:20
cut(x, c(0, 8, 15, 20))
This divides x into a factor with levels (0,8], (8,15], and (15,20].
-roger
Shayna Strom wrote:
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
Shayna Strom wrote:
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?
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
> I have the following variables, all of which are logicals
>
> fmar15 fcoc15 fher15fcrk15fidu15
>
> what I would like is a variable drug15 which equals
> idu if fidu15 is T; crk if fidu15 is F but fcrk is T, her if fher15 is
> T but fcrk15 and fidu15 are F and so on
>
> What's the
Hello
I have the following variables, all of which are logicals
fmar15 fcoc15 fher15fcrk15fidu15
what I would like is a variable drug15 which equals
idu if fidu15 is T; crk if fidu15 is F but fcrk is T, her if fher15 is
T but fcrk15 and fidu15 are F and so on
What's the best way to
37 matches
Mail list logo