On Apr 10, 2012, at 8:59 AM, David Winsemius wrote:
On Apr 10, 2012, at 3:16 AM, aajit75 wrote:
I have got solution using within function as below
dd$Seg <- 1
dd <- within(dd, Seg[x2> 0 & x3> 200] <- 1)
In this instance the first of your assignments appears superfluous.
dd <- within(dd,
On Apr 10, 2012, at 3:16 AM, aajit75 wrote:
I have got solution using within function as below
dd$Seg <- 1
dd <- within(dd, Seg[x2> 0 & x3> 200] <- 1)
In this instance the first of your assignments appears superfluous.
dd <- within(dd, Seg[x2> 100 & x3> 300] <- 2)
dd <- within(dd, Seg[x2>
On 10-04-2012, at 08:44, aajit75 wrote:
> Hi Experts,
>
> This may be simple question, I want to create new variable "seg" and assign
> values to it based on some conditions satisfied by each observation.
>
> Here is the example:
> ##Below are the conditions
>
> ##if variable x2 gt 0 and x3 gt
I have got solution using within function as below
dd$Seg <- 1
dd <- within(dd, Seg[x2> 0 & x3> 200] <- 1)
dd <- within(dd, Seg[x2> 100 & x3> 300] <- 2)
dd <- within(dd, Seg[x2> 200 & x3> 400] <- 3)
dd <- within(dd, Seg[x2> 300 & x3> 500] <- 4)
I sthere any better way of doing it!!
--
View th
Hi Experts,
This may be simple question, I want to create new variable "seg" and assign
values to it based on some conditions satisfied by each observation.
Here is the example:
##Below are the conditions
##if variable x2 gt 0 and x3 gt 200 then seg should take value 1,
##if variable x2 gt 100
5 matches
Mail list logo