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
-------------- n?chster Teil --------------
#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)
Working with ranges of a list
4 messages · Ferri Leberl, jim holtman
Is this what you want as output:
do.call('rbind', kaste)
[,1] [,2] [,3] [1,] "Bremerhaven" 53.55 8.58 [2,] "Cuxhaven" 53.87 8.7 [3,] "L??beck" 53.87 10.69
On Dec 16, 2007 8:54 AM, Mag. Ferri Leberl <ferri.leberl at gmx.at> wrote:
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
______________________________________________ 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
Thank you for the attempt.
On your advice I am working with lists to avoid the numbers (which are
geographical coordinates) becoming strings. The call you suggest does
not take care of that. Now I am trying to extract the coordinates from
the list efficiently. Of course I could make a loop, e.g.
punkte[,1]<-orte[[1]][[2[1]]]
being replaced by
for(n in 1:lang){
punkte[n,1]<-orte[[n]][[2[1]]]
punkte[n,2]<-orte[[n]][[3[1]]]
}
but I wonder if there was no more efficient way.
Faithfully,
Mag. Ferri Leberl
Am Sonntag, den 16.12.2007, 10:32 -0500 schrieb jim holtman:
Is this what you want as output:
do.call('rbind', kaste)
[,1] [,2] [,3] [1,] "Bremerhaven" 53.55 8.58 [2,] "Cuxhaven" 53.87 8.7 [3,] "L??beck" 53.87 10.69 On Dec 16, 2007 8:54 AM, Mag. Ferri Leberl <ferri.leberl at gmx.at> wrote:
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
______________________________________________ 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.
You can use the following to get the data from that call:
x <- do.call('rbind', kaste)
as.matrix(x[,2:3])
[,1] [,2] [1,] 53.55 8.58 [2,] 53.87 8.7 [3,] 53.87 10.69
On Dec 16, 2007 10:54 AM, Mag. Ferri Leberl <ferri.leberl at gmx.at> wrote:
Thank you for the attempt.
On your advice I am working with lists to avoid the numbers (which are
geographical coordinates) becoming strings. The call you suggest does
not take care of that. Now I am trying to extract the coordinates from
the list efficiently. Of course I could make a loop, e.g.
punkte[,1]<-orte[[1]][[2[1]]]
being replaced by
for(n in 1:lang){
punkte[n,1]<-orte[[n]][[2[1]]]
punkte[n,2]<-orte[[n]][[3[1]]]
}
but I wonder if there was no more efficient way.
Faithfully,
Mag. Ferri Leberl
Am Sonntag, den 16.12.2007, 10:32 -0500 schrieb jim holtman:
Is this what you want as output:
do.call('rbind', kaste)
[,1] [,2] [,3] [1,] "Bremerhaven" 53.55 8.58 [2,] "Cuxhaven" 53.87 8.7 [3,] "L??beck" 53.87 10.69 On Dec 16, 2007 8:54 AM, Mag. Ferri Leberl <ferri.leberl at gmx.at> wrote:
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
______________________________________________ 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?