500種のデータフレームと、さまざまな種の25,000ポイントの局所観測があります。個々の種のポイントマップを作成したいと思います。マップ上の各ポイントは種の出現です。作成するマップが非常に多いため、これをループで実行する必要があります。これは私がこれまでに持っているものです。
#loop for making species map 1.1
species <- levels(raw$SpCode)
for(i in 1:length(species))
{
#open the file for writing
pdf(species[i], file=".pdf", width=5, height=4)
plot (wrld_simpl, xlim=c(-100,-55), ylim=c(23,63), axes=TRUE, col='light grey')
box() #adds box around map
title(main=species[i]) #adds main title to map which should be the species name associated with the data
points(raw, species[i]$longitude, species[i]$latittude, col='black', pch=21, bg="red", cex=0.85)
dev.off()
}
私が得ている主なエラー出力は次のとおりです。
“Error in species[i]$longitude : $ operator is invalid for atomic vectors
In addition: Warning message:
‘mode(onefile)’ differs between new and previous==> NOT changing ‘onefile’"
これを進める方法についてのアドバイスは役に立ちます。maptoolsパッケージを使用して、これらのマップを作成しようとしています。
乾杯、イスラエル