<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt">Eder, muito obrigado, ajudou muito, vi que tenho no mesmo dia vários grupos. <br><br>Como faço para ter um único resultado por dia? Ou seja, para cada dia um único ponto no gráfico.<br><div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>[ ]'s.<br></span></div><div>Edson Lira<br>Estatístico<br>Manaus-Amazonas</div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div
dir="ltr"> <font face="Arial" size="2"> Em Terça-feira, 18 de Março de 2014 12:52, Éder Comunello <comunello.eder@gmail.com> escreveu:<br> </font> </div> <div class="y_msg_container"><div id="yiv3635552423"><div><div dir="ltr"><div style="font-family:arial, sans-serif;font-size:13px;">Edson, boa tarde!</div><div style="font-family:arial, sans-serif;font-size:13px;"><br clear="none"></div><div style="font-family:arial, sans-serif;font-size:13px;">Não sei se irá lhe atender, mas tentei alguma coisa com os dados de exemplo que você havia enviado (n=300). </div>
<div style="font-family:arial, sans-serif;font-size:13px;"><br clear="none"></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">### <code r></font></div><div style="font-family:arial, sans-serif;font-size:13px;">
<font face="courier new, monospace">### restaurando dados de exemplo!</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">dat <-
data.frame(tempo=c(30.48,32.17,32.32,32.68,33.42,34.1,34.33,35.12,35.95,36.18,36.73,36.75,36.78,37.05,37.18,38.1,38.4,40.05,40.62,40.87,41.33,41.38,41.5,41.63,43.38,43.65,43.85,43.88,44.37,45.67,45.73,46.17,46.5,46.75,47.17,47.55,47.63,47.65,49.62,49.85,49.98,50.65,51.15,51.67,51.7,51.97,53.12,53.23,53.77,54.08,54.18,54.32,54.65,54.98,55.55,56.47,58.13,58.65,58.93,59.2,59.67,59.92,60.08,60.28,60.63,60.93,61.78,62.58,63.42,63.93,64.13,65.12,66.02,66.55,67.23,67.85,71.32,73.03,73.68,75.1,75.52,79.75,79.93,80.88,81.23,91.85,103.73,109.27,115.65,123.63,131.88,173.28,30.68,31.68,32.1,33.12,33.25,33.48,34.5,35.15,35.52,35.87,36.52,36.63,36.75,39.32,40.37,41.4,41.57,41.57,41.78,43.85,44.05,44.97,45.47,45.93,47.03,47.1,47.35,47.63,48.3,48.38,48.62,48.85,48.88,49,49.87,50.65,50.73,51.07,51.42,51.8,52.08,52.72,52.83,53.23,53.32,53.57,53.68,54,54.12,54.23,54.28,54.5,55.13,55.32,55.65,55.85,56.02,56.15,56.43,56.45,56.58,56.58,57.22,57.77,57.78,58.17,58.43,58.57,58
.58,59.38,59.8,59.87,60.18,60.67,61.35,61.42,61.6,62.07,62.18,62.42,63.07,63.93,64.57,65.2,65.33,65.78,65.8,66.38,66.55,66.78,67.07,67.43,67.57,68.28,68.3,68.32,68.43,68.68,68.82,69,69.55,70.22,70.58,71.42,71.6,72.13,72.17,72.55,72.57,72.67,72.7,72.8,72.8,73.38,73.38,73.67,74.28,75.05,75.4,75.53,75.75,76.6,77.75,78.22,78.42,78.47,78.63,79.27,79.58,79.78,80.18,81.53,81.78,82.17,84.87,85.07,85.2,85.77,86.37,87.25,88.78,88.93,88.98,89.68,91,92.62,93.5,93.83,95.12,97.1,97.23,97.77,98.83,101.47,107.87,108.17,109.07,112.25,112.58,113.53,113.75,119.48,121.32,132.88,139.73,31.95,32.4,35.2,35.35,36.62,36.88,37.62,38.65,39.68,40.05,41.25,41.28,42,42.03,42.23,42.63,42.67,43.02,43.32,43.32,44.23,44.27,44.7,45.08,46.42,48.17,48.25,49.55,50.13,50.85,50.97,51.85,52.28,52.85,52.9,53.13,54.23,54.98,55.45,56.28,56.53,57.33,57.75), dia_doa=rep(c(1:3), c(92,165,43)))</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">table(dat$dia_doa)</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">### (r)andom (Pos)itions (dentro de cada dia)</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><span style="font-family:'courier new', monospace;">{set.seed(765); rPos <- unlist(sapply(unique(dat$dia_doa), function(x) sample(which(dat$dia_doa==x))))}</span><br clear="none">
</div><div style="font-family:arial, sans-serif;font-size:13px;"><span style="font-family:'courier new', monospace;">### set.seed() é pra controle do CMR, considere removê-lo</span><font face="courier new, monospace"><br clear="none">
</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">rDat <- dat[rPos,]; head(rDat)</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">rDat$dia_doa ### observe que não muda ordem dos dias!</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">dN <- unique(table(dat$dia_doa)) ### dados em cada dia!</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">grp <- NULL; for (n in dN) grp <- c(grp, rep(1:ceiling(n/5), each=5, len=n)) ### grupos dentro de dias</font></div><div style="font-family:arial, sans-serif;font-size:13px;">
<font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">DAT <- cbind(rDat, grp); row.names(DAT) <- NULL; head(DAT)</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">DAT$id <- DAT$dia_doa*1000+DAT$grp ### cria um id/label único para grupos!</font></div><div style="font-family:arial, sans-serif;font-size:13px;">
<font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">### Caso deseje remover dados/grupos incompletos...</font></div><div style="font-family:arial, sans-serif;font-size:13px;">
<font face="courier new, monospace">grp.i <- names(table(DAT$id))[table(DAT$id)<5];grp.i ### grupos incompletos</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">dat.i <- unlist(sapply(grp.i, function(x) which(DAT$id==x))); dat.i ### dados pertencentes a grupos incompletos</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none"></font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">DAT[dat.i,] ### linhas dos grupos incompletos</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">DATCompl <- DAT[-dat.i,] ### só grupos completos</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">table(DATCompl$dia_doa)</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">table(DATCompl$id)</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none">
</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">###</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace"><br clear="none"></font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">require(qcc)</font></div><div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">qcc(qcc.groups(DAT$tempo, DAT$id)) ### todos</font></div>
<div style="font-family:arial, sans-serif;font-size:13px;"><font face="courier new, monospace">qcc(qcc.groups(DATCompl$tempo, DATCompl$id)) ### somente completos</font></div><div style="font-family:arial, sans-serif;font-size:13px;">
<font face="courier new, monospace">### </code></font></div><div class="yiv3635552423yqt5748916579" id="yiv3635552423yqtfd99428"><div style="font-family:arial, sans-serif;font-size:13px;"><br clear="none"></div><div class="yiv3635552423gmail_extra" style="font-family:arial, sans-serif;font-size:13px;"><div class="yiv3635552423im">
<br clear="all"><div><div dir="ltr"><span style="font-family:arial;font-size:small;color:rgb(34,34,34);">Éder Comunello <</span><a rel="nofollow" shape="rect" ymailto="mailto:comunello.eder@gmail.com" target="_blank" href="mailto:comunello.eder@gmail.com" style="font-family:arial;font-size:small;">c</a><a rel="nofollow" shape="rect" ymailto="mailto:omunello.eder@gmail.com" target="_blank" href="mailto:omunello.eder@gmail.com" style="font-family:arial;font-size:small;">omunello.eder@gmail.com</a><span style="font-family:arial;font-size:small;color:rgb(34,34,34);">> </span><br clear="none">
</div></div></div></div><div class="yiv3635552423gmail_extra"><div><div dir="ltr">Dourados, MS - [22 16.5'S, 54 49'W]<br clear="none"></div></div>
<br clear="none"><br clear="none"></div></div></div></div></div><br><br></div> </div> </div> </div> </div></body></html>