Re: [R] substitute NA values

2007-03-31 Thread Jim Lemon
Sergio Della Franca wrote: > Dear R-Helpers, > > > I have the following data set(y): > > Test_Result #_Test > t 10 > f 14 > f 25 > f NA > f 40 > t45 > t

Re: [R] substitute NA values

2007-03-30 Thread Charilaos Skiadas
On Mar 30, 2007, at 10:56 AM, Gavin Simpson wrote: > This is R, there is always a way (paraphrasing an R-Helper the name of > whom I forget just now). Can't resist, it's one of my favorite fortunes ;) That would be Simon 'Yoda' Blomberg: library(fortunes) fortune(109) Haris Skiadas Department

Re: [R] substitute NA values

2007-03-30 Thread Gavin Simpson
On Fri, 2007-03-30 at 16:25 +0200, Sergio Della Franca wrote: > This is that i obtained. > > There isn't a method to replace the NA values only for character variable? This is R, there is always a way (paraphrasing an R-Helper the name of whom I forget just now). If you mean a canned function, no

Re: [R] substitute NA values

2007-03-30 Thread Gabor Grothendieck
Not as part of na.roughfix. You could convert your character strings to factors and back again: library(randomForest) DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5), c = c("b", "b", NA, "d", "e"), d = factor(c("a", "a", NA, "d", "e")), stringsAsFactors = FALSE) DF$a <- factor(D

Re: [R] substitute NA values

2007-03-30 Thread Sergio Della Franca
This is that i obtained. There isn't a method to replace the NA values only for character variable? 2007/3/30, Gabor Grothendieck <[EMAIL PROTECTED]>: > > I assume you are referring to na.roughfix in randomForest. I don't think > it > works for logical vectors or for factors outside of data

Re: [R] substitute NA values

2007-03-30 Thread Gabor Grothendieck
I assume you are referring to na.roughfix in randomForest. I don't think it works for logical vectors or for factors outside of data frames: > library(randomForest) > DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5)) > na.roughfix(DF) Error in na.roughfix.data.frame(DF) : na.roughfix onl

[R] substitute NA values

2007-03-30 Thread Sergio Della Franca
Dear R-Helpers, I have the following data set(y): Test_Result #_Test t 10 f 14 f 25 f NA f 40 t45 t44 47 tNA I want to

Re: [R] substitute NA values

2007-03-28 Thread Jorge Cornejo-Donoso
This could work, but not with big matrix! year <- c(1990,1995,2000,2005) Prod <- c(2478,3192,NA,1594) matrix <- data.frame(cbind(year,Prod)) for (i in 1:dim(matrix)[1]) { if (is.na(matrix[i,2])) {matrix[i,2] <- 0} } __ R-help@st

Re: [R] substitute NA values

2007-03-28 Thread Uwe Ligges
See ?is.na and use its result for indexing. Uwe Ligges Sergio Della Franca wrote: > Dearl R-Helpers, > > > I have the following data set: > > YEAR PRODUCTS > 1990 2478 > 1995 3192 > 2000 NA > 2005 1594 > > > I wanto to replace NA values, in the PRODUCTS column, with 0. > >

Re: [R] substitute NA values

2007-03-28 Thread Marc Schwartz
On Wed, 2007-03-28 at 16:21 +0200, Sergio Della Franca wrote: > Dearl R-Helpers, > > > I have the following data set: > > YEAR PRODUCTS > 1990 2478 > 1995 3192 > 2000 NA > 2005 1594 > > > I wanto to replace NA values, in the PRODUCTS column, with 0. > > > How can i obtain t

[R] substitute NA values

2007-03-28 Thread Sergio Della Franca
Dearl R-Helpers, I have the following data set: YEAR PRODUCTS 1990 2478 1995 3192 2000 NA 2005 1594 I wanto to replace NA values, in the PRODUCTS column, with 0. How can i obtain this? Thak you in advance. Sergio Della Franca [[alternative HTML version deleted]