[R-sig-Geo] problems for reading ASCII file

Robert J. Hijmans r.hijmans at gmail.com
Tue Oct 13 00:20:21 CEST 2015


Ana Carolina,

You say you are using ascii because:

> i am trying to process a raster image (the one i transformed to ASCII)
> but it is too big to work with it as a raster in R (i am having memory
> problems)...thats why i am trying to see if its simplier to process it
> in ASCII and then bring it back to raster.

That does not make much sense.  Either way you have a very small
raster (260 by 193) and I cannot imagine how that could be to big for
the memory of any computer.
So there is probably something else that is going wrong; that should
be fixed (Now it seems that you are trying to solve the problem by
breaking something unrelated that is not broken.)

Robert



On Wed, Oct 7, 2015 at 12:48 AM, ana carolina cuellar
<anacarocuellar at gmail.com> wrote:
> Hi All, I am trying to read an ASCII file into R and is the first time i am
> trying to work with ASCII files. I saw a previous discussion that this
> command can be used:
>
> library(rgdal)
> library(maptools)
> grid <- readAsciiGrid("<your file and its path>")
> table <- data.frame(grid)
>
> in my case:  grid <- readAsciiGrid("I:/modisv5sm0112_2/prueb/amaascii.txt")
>
>
> but when i used the readAsciiGrid function i get this error:
>
> Error in validObject(.Object) :
>
>   invalid class “GridTopology” object: cells.dim has incorrect dimension
>
>
> Can anybody tell me why? i dont get why it doesnt work :(
>
> my ASCII file looks like this:
>
> ncols         260
> nrows         193
> xllcorner     12,397449031167
> yllcorner     55,534017291881
> cellsize      0,0012386489974299
> NODATA_value  -9999
> -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 25 25....etc
>
>
> i am trying to process a raster image (the one i transformed to ASCII)
> but it is too big to work with it as a raster in R (i am having memory
> problems)...thats why i am trying to see if its simplier to process it
> in ASCII and then bring it back to raster.
>
> Thanks a lot!!
>
> Ana
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list