[R] Error in rownames

Adams, Jean jvadams at usgs.gov
Fri Sep 19 22:46:22 CEST 2014


Chris,

It's hard to troubleshoot without reproducible code.  I suggest you post a
simple example of code that we can run.  For example, use
     dput(training[1:20, ])
to spit out the first 20 lines of the training data.  Then simplify the
rest of the code as much as possible.

library(yaImpute)
training <- <<< insert output from dput(training[1:20, ]) here >>>
y <- subset(training, select = c(ResponseSu))
x <- subset(training, select = c(sinaspect, habitat, slope, elevation,
cosaspect, disttoroad, disttowat))
type.rf <- yai(x=x, y=y, method="randomForest", rfMode="regression", ntree=
20)
outfile <- list(Type = "RespSurf_Reg.asc")
xfile <-list(sinaspect ="sinaspect.asc", habitat ="habitat.asc", elevation
="elevation.asc",
disttowat ="disttowat.asc", disttoroad ="disttoroad.asc", slope
="slope.asc", cosaspect ="cosaspect.asc")
AsciiGridImpute(type.rf, xfile, outfile)

Jean


On Fri, Sep 19, 2014 at 9:10 AM, Chris Jackson-Jordan <
jacksonjordancm at gmail.com> wrote:

> Dear fellow R users,
>
> I am trying to run the random forest and Yaimpute packages in R to
> impute a grid to project in a gis. However, after running the
> imputation I keep getting an error in the rownames. This sounds simple
> enough, but I cannot figure out what these rownames are reffering to.
> Any ideas? I am fairly new to R so im sure it is an easy fix. Any help
> would be awesome.
>
> Thanks,
>
> Chris
>
>
> > training <-
> read.csv("D:/R_Desktop_Data/RF_RespSurf/RndmPts_RespSurfMIII.csv")> y <-
> subset(training, select = c(ResponseSu))> x <- subset(training, select =
> c(sinaspect, habitat, slope, elevation, cosaspect, disttoroad, disttowat))>
> type.rf <- yai(x=x, y=y, method="randomForest", rfMode="regression", ntree=
> 2000)> outfile <- list(Type =
> "D:/R_Desktop_Data/RF_RespSurf/RespSurf_Reg.asc")> xfile <-list(sinaspect
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/sinaspect.asc",
> habitat
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/habitat.asc",
> elevation
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/elevation.asc",
> disttowat
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/disttowat.asc",
> disttoroad
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/disttoroad.asc",
> slope ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_N!
>  Nimp/ModelI/ASCII_Files2/slope.asc", cosaspect
> ="C:/Users/jacksonjordancm/Desktop/R_Desktop_Data/RF_NNimp/ModelI/ASCII_Files2/cosaspect.asc")>
> AsciiGridImpute(type.rf, xfile, outfile)Rows per dot:  19  Rows to do: 1900
> ToDo:
> ....................................................................................................
> Done: .Error in `rownames<-`(`*tmp*`, value = c("23x0049", "23x0050",
> "23x0051",  :
>   attempt to set rownames on object with no dimensions
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list