[R-sig-Geo] sapply function

Hodgess, Erin HodgessE at uhd.edu
Tue Jul 9 17:30:03 CEST 2013


Hi!

Did you have a "return" after the quotes for coords, please?  R doesn't like to have the quotes separately.



lns <- slot(auck_shore, "lines")
table(sapply(lns, function(x) length(slot(x, "Lines"))))
islands_auck <- sapply(lns, function(x) {
  crds <- slot(slot(x, "Lines")[[1]], "coords")
  identical(crds[1,], crds[nrow(crds),])
})
table(islands_auck)

Hope this helps!

Sincerely,
Erin

________________________________________
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Thomas AUBINEAU [thomas.aubineau.gds35 at reseaugds.com]
Sent: Tuesday, July 09, 2013 10:01 AM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] sapply function

Hello,

I've still a problem with script written in ASDAR book, and more precisely
with sapply function, as you can see in the script below. I've try to
decompose the script in several sentences, but it doesn't work (I think I
don't understand what is written in the whole sentence).

Someone can help me?



Sincerely.





lns<-slot(auck_shore,"lines")

> aucksap<-sapply(lns,length)

> table(aucksap)

aucksap

 1

80

>
islands_auck<-sapply(lns,function(x){crds<-slot(slot(x,"Lines")[[1]],"coords
")identical(crds[1,],crds[nrow(crds),])})

Error: unexpected symbol in
"islands_auck<-sapply(lns,function(x){crds<-slot(slot(x,"Lines")[[1]],"coord
s")identical"







Thomas AUBINEAU

Responsable technique GDS 35

ZA Atalante Champeaux

35042 RENNES CEDEX

0223482600 / 0623258789




        [[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