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






On Mon, Mar 22, 2010 at 8:05 PM, tj<girlm...@yahoo.com>  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 : 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.
I need this output: (na,na,na,na,na)

Thank you for your time and help!=)
--
View this message in context: 
http://n4.nabble.com/Create-NA-tp1678543p1678543.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to