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
t44
NA
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
NA 47
tNA
I want
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 only
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
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(DF$a)
DF$c -
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, not
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
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
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 this?
Thak
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.
How can i
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}
}
__
11 matches
Mail list logo