Hello,
I didn't see the following message error because the sink() function was running in my function :

> var2<-as(var,"psp")
Erreur dans owin(xr, yr, poly = list(x = xr[c(1, 2, 2, 1)], y = yr[c(1, 1,  : 
  yrange should be a vector of length 2 giving (ymin, ymax)

the traceback of this function give:

> traceback()
14: stop("yrange should be a vector of length 2 giving (ymin, ymax)")
13: owin(xr, yr, poly = list(x = xr[c(1, 2, 2, 1)], y = yr[c(1, 1, 
        2, 2)]), unitname = unitname(W))
12: switch(W$type, rectangle = {
        xr <- W$xrange
        yr <- W$yrange
        return(owin(xr, yr, poly = list(x = xr[c(1, 2, 2, 1)], y = yr[c(1,
 
            1, 2, 2)]), unitname = unitname(W)))
    }, polygonal = {
        return(W)
    }, mask = {
        stop("A mask cannot be converted to a polygon")
    })
11: as.polygonal(x)
10: owin2gpc(B)
9: union.owin(W, Wlist[[i]])
8: superimposePSP(y, window = window)
7: FUN(X[[74L]], ...)
6: lapply(lin, as.psp.Lines)
5: as.psp.SpatialLines(y, window = window, marks = marks)
4: as.psp(y, window = window, marks = marks)
3: as.psp.SpatialLinesDataFrame(from)
2: asMethod(object)
1: as(var, "psp")

For my working environment, the sessionInfo returns:

> sessionInfo()
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32
 

locale:
LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] maptools_0.7-20 foreign_0.8-29  spatstat_1.15-0 deldir_0.0-7    gpclib_1.4-3    mgcv_1.4-1.1    rgdal_0.6-7    
[8] sp_0.9-32      

loaded via a namespace (and not attached):
[1] grid_2.8.1      lattice_0.17-17

If you need the Rdada, I can join it to you by personnal mail.

Perhaps it is due to this particular shapefile?

Thanks by advance,
Quentin


--- En date de : Jeu 26.3.09, Torleif Markussen Lunde <torleif.lunde@cih.uib.no> a écrit :
De: Torleif Markussen Lunde <torleif.lunde@cih.uib.no>
Objet: Re: [R-sig-Geo] as.psp don't work for big shapefiles?
À: r-sig-geo@stat.math.ethz.ch, qlemouland@yahoo.fr
Date: Jeudi 26 Mars 2009, 22h08

Hi 

I tried to convert a SpatialLinesDataFrame with 
dim(var@data)
10615     4
and 153665 coordinate pairs.

It worked fine (as.psp(var)), but took about an hour to run.

sessionInfo()
R version 2.8.1 (2008-12-22) 
i386-redhat-linux-gnu        

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
                                 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] maptools_0.7-20 foreign_0.8-29  sp_0.9-32       spatstat_1.15-0
[5] deldir_0.0-7    gpclib_1.4-3    mgcv_1.4-1.1

loaded via a namespace (and not attached):
[1] grid_2.8.1      lattice_0.17-17

Do you get any error messages? Does traceback() return anything?

This probably did not help, but if you could provide some more information, it 
would be nice. You could also start as.psp and abort it (ctrl+c) and run 
traceback to see if anything happened.

Best wishes 
Torleif

On Thursday 26 March 2009 04:33:05 pm Quentin LEMOULAND wrote:
> Hello,
>
> I have written a code that nead to convert SpatialLinesDataFrame to psp in
> order to use statstat functions.
>
> This functiun works well.
> The problem is that when the shapefile is to big (all the little rivers of
> a region for example: 3000), the as.psp function doesn't return
anything
> and var2 is nothing:
>
> if (class(var)=="SpatialLinesDataFrame")
>
> {var@data<-data.frame(c(1:dim(var@data)[1]))
>
> var2<-as(var,"psp")}
>
> When I just select a few rivers (100), no problem.
>
> Does anyone know how to solve it?
>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Torleif Markussen Lunde
Centre for International Health/
Bjernes Centre for Climate Research
University of Bergen, Norway



      
	[[alternative HTML version deleted]]

