[R] Loop Help

Fernando McRayearth urayearth at gmail.com
Mon Feb 29 15:24:33 CET 2016


Need to create ascii maps for 10 species by writing a loop. So i have to have the vectors ready in the Global Environment, and the "raster map" so the information can be added. 

when writing the loop I am using the "paste" function because the only thing that changes in the vector is the name of the specie ( ens_KAPPA_F45_Ambystoma.altamirani, ens_KAPPA_F45_Ambystoma.lermaense), now the issue is that the result returns it like this "Ambystoma.lermaense" , and i don't know how to bring the vector without the "". any suggestions? thanks. 


CURRENT CODE NOT WORKING 
for (i in 1:length(amph_nome)){
orden=match(testo,0:93831)
amf1=paste("ens_KAPPA_F45_",amph_nome[i],sep="")

amf3=amf2[orden]
r1=Map
values(r1)=amf2
}


IF I WAS TO DO IT ONE BY ONE THIS VERSION WORKS 

orden=match(testo,0:93831)
amf0=ens_KAPPA_F45_Ambystoma.altamirani[orden]
r1=Map
values(r1)=amf0

writeRaster(r1, filename = "r1.asc",dataType=ascii,overwrite=TRUE)

Sent from Mail for Windows 10


	[[alternative HTML version deleted]]



More information about the R-help mailing list