Re: [R] Create NA

2010-03-27 Thread Uwe Ligges
On 23.03.2010 04:27, stephen sefick wrote: I think you don't need to multiply... you need to figure out where your NAs need to be and then index the vector and assign "NA" to it: x[1:5]<- "NA" ... which would coerce x to be character while x[1:5] <- NA keeps the mode of x. Uwe Ligges

Re: [R] Create NA

2010-03-22 Thread stephen sefick
I think you don't need to multiply... you need to figure out where your NAs need to be and then index the vector and assign "NA" to it: x[1:5] <- "NA" On Mon, Mar 22, 2010 at 8:05 PM, tj wrote: > > Hi, > > How can I create an NA? > for example, i have this program but it has errors > >> x=scan()

Re: [R] Create NA

2010-03-22 Thread Jorge Ivan Velez
Hi tj, May be the following? x <- 1:5 NA*x rep(NA, length(x)) HTH, Jorge On Mon, Mar 22, 2010 at 9:05 PM, tj <> wrote: > > Hi, > > How can I create an NA? > for example, i have this program but it has errors > > > x=scan() > 1: 1 2 3 4 5 > 6: > Read 5 items > > "na"*x > Error in "na" * x : n

[R] Create NA

2010-03-22 Thread tj
Hi, How can I create an NA? for example, i have this program but it has errors > x=scan() 1: 1 2 3 4 5 6: Read 5 items > "na"*x Error in "na" * x : non-numeric argument to binary operator what should I multiply x so that I will get an NA? And I really need to multiply that with my x vector.