[R] Help with yaImpute

Wesley Roberts wroberts at csir.co.za
Mon Jul 28 11:43:54 CEST 2008


Dear fellow R-users

I am trying to do some imputation using K-NN with the yaImpute library. All seems to be going well until I try to use 
AsciiGridImpute. All my data are correctly formatted and I am able to run and view the results of yai. Below is my code:
****************************************************************************************************
library("yaImpute")
data <- read.csv("Data.csv", header=TRUE, sep=",")
y <- subset(data, select = c(BA_PER_HA_))
x <- subset(data, select = c(IK1_mean,IK2_mean,IK3_mean,IK4_mean))


RF <- yai(x = x, y = y, method = "randomForest")


xfiles <- list(IK1_mean = "IK1_mean.asc", IK2_mean = "IK2_mean.asc",
IK3_mean = "IK3_mean.asc", IK4_mean = "IK4_mean.asc")

outfiles <- list(BA_PER_HA_ = "BasalAreaPerHA.asc")

AsciiGridImpute(RF, xfiles, outfiles)
****************************************************************************************************

And here is the error I receive

################################################################
> source("K-NN-Basal-Area.R")
Loading required package: randomForest
randomForest 4.5-25
Type rfNews() to see new features/changes/bug fixes.
Rows per dot:  10  Rows to do: 1062 
ToDo: ..........................................................................................................
Done: 
First six lines of predicted data for map row:  1 
       object.yRefs...toKeep.
1x0001                  -9999
1x0002                  -9999
1x0003                  -9999
1x0004                  -9999
1x0005                  -9999
1x0006                  -9999
Error in AsciiGridImpute(RF, xfiles, outfiles) : 
  BA_PER_HA_ is not present in the predicted data
################################################################

The first six lines of the output file contain the header information for an ESRI ASCII grid and look like this
ncols 1564
nrows 1062
xllcorner -77876.53335875
yllcorner -3304144.3940076
cellsize 4.000718
NODATA_value -9999

Which is exactly the same as the input ascii grids used during the AsciiGridImpute command.

I was wondering if anyone on the R mailing list had ever come across this error and if so how did you correct it.

I am using R version 2.7.1 on Ubuntu 7.10

Many thanks for all your help.
Kind regards,
Wesley Roberts


-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


and is believed to be clean.  MailScanner thanks Transtec Computers for their support.



More information about the R-help mailing list