<div dir="ltr"><div>Leonardo, boa tarde!</div><div><br></div><div>Fiquei na dúvida quanto ao uso de as.ordered() e rodei um pequeno teste. Parece funcionar do mesmo modo que com as.factor().</div><div><br></div><div><span style="font-family:monospace,monospace">### <code r></span><br></div><div><span style="font-family:monospace,monospace">getwd()</span><br></div><div><font face="monospace, monospace">url0 <- "<a href="ftp://geoftp.ibge.gov.br/malhas_digitais/municipio_2007/escala_2500mil/proj_geografica_sirgas2000/uf/mt/51mu2500gsr.zip">ftp://geoftp.ibge.gov.br/malhas_digitais/municipio_2007/escala_2500mil/proj_geografica_sirgas2000/uf/mt/51mu2500gsr.zip</a>"</font></div><div><font face="monospace, monospace">bName <- sub(".zip$", "", basename(url0))</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">setInternet2(FALSE) ### download a partir de ftp no RStudio Windows</font></div><div><font face="monospace, monospace">if (!file.exists(basename(url0))) download.file(url0, dest=basename(url0), mode="wb")</font></div><div><font face="monospace, monospace">unzip(basename(url0), list=T) ### conteúdo do zip</font></div><div><font face="monospace, monospace">unzip(basename(url0))</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">require(rgdal) </font></div><div><span style="font-family:monospace,monospace">mt <- readOGR(dsn=paste0(bName,".shp"), layer=bName, encoding="latin1")</span><br></div><div><font face="monospace, monospace">str(mt, max=2)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">plot(mt)</font></div><div><font face="monospace, monospace">head(mt@data)</font></div><div><font face="monospace, monospace">n <- nrow(mt@data); n</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">set.seed(756); x <- sample(LETTERS[1:3], size = n, replace=T)</font></div><div><font face="monospace, monospace">mt@data$X1 <- as.factor(x)</font></div><div><font face="monospace, monospace">mt@data$X2 <- as.ordered(x)</font></div><div><br></div><div><font face="monospace, monospace">str(mt@data)</font></div><div><font face="monospace, monospace">head(mt@data)</font></div><div><font face="monospace, monospace">spplot(mt, "X1", col.regions=heat.colors(3))</font></div><div><font face="monospace, monospace">spplot(mt, "X2", col.regions=heat.colors(3))</font></div><div><span style="font-family:monospace,monospace">### </code></span><br></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Éder Comunello <<a href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>> <br>Dourados, MS - [22 16.5'S, 54 49'W]<br></div></div></div>
<br><div class="gmail_quote"><br></div></div></div>