s-news
[Top] [All Lists]

data manipulation

To: <s-news@lists.biostat.wustl.edu>
Subject: data manipulation
From: "Zheng_Jenny" <Zheng_Jenny@Allergan.com>
Date: Fri, 27 Oct 2006 11:33:40 -0700
Thread-index: Acb59myo33RE34+sQGyKlX5ARqhqlw==
Thread-topic: data manipulation

Hi, everyone,

Would anyone help me with the problem below?

 

I have a dataset x including ID, Time, DV and ID2.

 

I can use

x$DV[x$Time==0]_0 to make DV=0 when Time is 0 but when I was trying to use command “x$ID2[x$Time==0]_"zero"” to make ID2==zero when Time is 0, I received the following message”

 

Warning messages:

  replacement values not all in levels(x): NA's generated in: .A0[x$Time ==

   0]  <-  "zero"

 

Why is that? How can I do what I want to do? What would be effective command to change DV=0 when time is 0,2 and 4. Thanks in advance.

 

 

 

Jenny

 

 

x_data.frame(ID=seq(1,10,1),Time=rep(c(0,1,2,3,4),2),DV=rnorm(10,0,1),ID2=rep(sample(letters,5),2))

x$DV[x$Time==0]_0

x$ID2[x$Time==0]_"zero"

Warning messages:

  replacement values not all in levels(x): NA's generated in: .A0[x$Time ==

   0]  <-  "zero"

 

 

 

<Prev in Thread] Current Thread [Next in Thread>