<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Que bom, então!<br></div>
<div> </div>
<div id="sig4487139"><div class="signature" id="signature"><a href="http://lattes.cnpq.br/9234772336296638" title="Currículo Lattes">Leonardo Ferreira Fontenelle</a><br></div>
</div>
<div> </div>
<div> </div>
<div>Em Ter 21 abr. 2015, às 17:44, Éder Comunello escreveu:<br></div>
<blockquote type="cite"><div dir="ltr"><div>Leonardo, boa tarde!<br></div>
<div> </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().<br></div>
<div> </div>
<div><span style="font-family:monospace,monospace" class="font">### <code r></span><br></div>
<div><span style="font-family:monospace,monospace" class="font">getwd()</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">url0 <- "<a defang_rel="noreferrer" 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>"</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">bName <- sub(".zip$", "", basename(url0))</span><br></div>
<div> </div>
<div><span style="font-family:monospace," monospace"" class="font">setInternet2(FALSE) ### download a partir de ftp no RStudio Windows</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">if (!file.exists(basename(url0))) download.file(url0, dest=basename(url0), mode="wb")</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">unzip(basename(url0), list=T) ### conteúdo do zip</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">unzip(basename(url0))</span><br></div>
<div> </div>
<div><span style="font-family:monospace," monospace"" class="font">require(rgdal) </span><br></div>
<div><span style="font-family:monospace,monospace" class="font">mt <- readOGR(dsn=paste0(bName,".shp"), layer=bName, encoding="latin1")</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">str(mt, max=2)</span><br></div>
<div> </div>
<div><span style="font-family:monospace," monospace"" class="font">plot(mt)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">head(mt@data)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">n <- nrow(mt@data); n</span><br></div>
<div> </div>
<div><span style="font-family:monospace," monospace"" class="font">set.seed(756); x <- sample(LETTERS[1:3], size = n, replace=T)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">mt@data$X1 <- as.factor(x)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">mt@data$X2 <- as.ordered(x)</span><br></div>
<div> </div>
<div><span style="font-family:monospace," monospace"" class="font">str(mt@data)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">head(mt@data)</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">spplot(mt, "X1", col.regions=heat.colors(3))</span><br></div>
<div><span style="font-family:monospace," monospace"" class="font">spplot(mt, "X2", col.regions=heat.colors(3))</span><br></div>
<div><span style="font-family:monospace,monospace" class="font">### </code></span><br></div>
<div> </div>
<div><div> </div>
<div><div><div dir="ltr">Éder Comunello <<a defang_rel="noreferrer" href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a defang_rel="noreferrer" href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>> <br></div>
<div dir="ltr">Dourados, MS - [22 16.5'S, 54 49'W]<br></div>
</div>
</div>
<div> </div>
<div defang_data-gmailquote="yes"> </div>
</div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>R-br mailing list<br></div>
<div><a defang_rel="noreferrer" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br></div>
<div><a defang_rel="noreferrer" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br></div>
<div>Leia o guia de postagem (<a defang_rel="noreferrer" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></div>
</blockquote></body>
</html>