[R] Working with ranges of a list

From: Mag. Ferri Leberl <ferri.leberl_at_gmx.at>
Date: Sun, 16 Dec 2007 14:54:17 +0100


Dear everybody!
Please find attached a tiny R-program. It returns:

      [,1] [,2]
[1,] 53.55 NA
[2,] 53.55 NA
[3,] 53.55 NA

How can I manage the first column to show the second component not only of the first list in küste but of the second component of every list in küste respectively, such as to get the following array returned:

      [,1] [,2]
[1,] 53.55 NA
[2,] 53.87 NA
[3,] 53.87 NA

Thank you in advance.
yours,
Mag. Ferri Leberl

#Programm zur Erstellung eines Wasserwegenetzplanes

#Städte
#TLD.Stadtkürzel<-list("Stadtname",Breite,Länge)

de.cux<-list("Cuxhaven",53.87,8.7)

de.hl<-list("Lübeck",53.87,10.69)
de.hb.br<-list("Bremerhaven",53.55,8.58)

see<-function(orte){
lang<-length(orte)
punkte<-array(,c(lang,2))
punkte[,1]<-orte[[1]][[2[1]]]
punkte
}
küste<-(list(de.hb.br,de.cux,de.hl))
see(küste)



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. Received on Sun 16 Dec 2007 - 15:20:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 16 Dec 2007 - 16:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.